/*Methods for the expert specialties*/
var strErrorStatus="";
var otherSpec ="" 	
var arrSpec =null;

  AddOnload(LoadExpertSpecialties);
								 
//window.onload = function () 
//{ 	 
//    if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
//      
//	LoadExpertSpecialties();  
//}

 function LoadExpertSpecialties() 
 {        
    if (typeof( PageMethods.GetExpertSpecialties)!= "undefined")
    {
        PageMethods.GetExpertSpecialties(expertID,excludeCatID, seoName, OnSucceededSpecialties, OnFailedSpecialties);
    }        
 }
  // Callback function invoked on successful 
// completion of the page method.
function OnSucceededSpecialties(result, userContext, methodName) 
{
   if (methodName == "GetExpertSpecialties")
   {    
              
        arrSpec = result;      
   }
}

function drawSpecialties(divOpened)
{
    if(arrSpec==null)
    {
        return "";
    } 
    

    otherSpec="<table style='height:100%' >"
    otherSpec+= "<tr><td>"    
    otherSpec+= "<table border='0'>";
    otherSpec+="<tr><td class='verspace2'></td></tr>"
    otherSpec+= "<tr><td colspan='2'  class='closeBtn'><a href='javascript:void(0)' onClick='overlayclose(\"" + divOpened + "\")'; return false><img src='"+ImgPathHelper.getPath('/images/ExpertProfile/close-x-blue.gif') +"' /></a></td></tr>"
    otherSpec+= "<tr><td></td><td class='text-left' colspan='2'><span class='boxTitle'>Other Specialties</span></td></tr>";
    var imageCell = "<td class='arrowBlue' ><img src='"+ ImgPathHelper.getPath('/images/expertprofile/arrow-blue.gif')+"' style='border-width:0px' /></td>";
        
    for (var i = 0;i<arrSpec.length;i++)
    {
        otherSpec+="<tr>" 
        otherSpec+= imageCell ;
        otherSpec+= "<td><a class='text5' href='"+ arrSpec[i].Second +"' >"+ arrSpec[i].First + "</a></td>"
        otherSpec+="<tr>"
             
    }         
      
    otherSpec+="</table>"        
    otherSpec+= "</td></tr>"  
    otherSpec+= "<tr><td class='closeBtn'><a href='javascript:void(0)' onClick='overlayclose(\"" + divOpened +"\")'; return false>Close</td></tr>"
    otherSpec+="</table>"        
    
    return otherSpec;
    
}

// Callback function invoked on failure 
// of the page method.
function OnFailedSpecialties(error, userContext, methodName) 
{
	//Error
}
/*End specialties*/


function openConverter(){
	window.open('/billing/utilities/currency-converter.aspx','help','scrollbars=no,height=168,width=560,menubar=no,resizable=yes,titlebar=no,toolbar=no,status=no')
}

function openConverter2(fee){
	window.open('/billing/utilities/currency-converter.aspx?fee='+fee,'help','scrollbars=no,height=168,width=560,menubar=no,resizable=yes,titlebar=no,toolbar=no,status=no')
}
function openUrl(url) {
	window.open(url,"_self");
}

 
function openCNotifier(memID,CatID){
	window.open('/account/notifications/online-notification.aspx?conMemID=' + memID +'&CatID=' + CatID ,'notify','scrollbars=yes,height=248,width=400,menubar=no,resizable=yes,titlebar=no,toolbar=no,status=no')
}

function openRating(memID){
	window.open('/rating/expert-rating.aspx?i_MemID='+memID,'rating','scrollbars=yes,height=400,width=450,menubar=no,resizable=yes,titlebar=no,toolbar=no,status=no')
}

function getposOffset(overlay, offsettype)
{
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function overlay(curobj, subobjstr, opt_position,objToClose)
{    

    var secondObject = document.getElementById(objToClose)    
    if (secondObject!=null)
    {
        secondObject.style.display='none'
    }
    
    if (document.getElementById){
    var subobj=document.getElementById(subobjstr)
    
    var content = drawSpecialties(subobjstr) ;
 
    if (content=="") 
    {
        return false;
    }
    
    subobj.innerHTML = content ;    
    subobj.style.display=(subobj.style.display!="block")? "block" : "none"

    var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
    var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
    if (opt_position!=null)
    
    {   
        HowMuchScrolled();
        ClientSize();
       
        var objPos = findPosY(curobj);           
        if (opt_position=="top" && (yScrolled < 320 - (theClientHeight - objPos) ))
        {                                       
            var ypos=(theClientHeight +  yScrolled -324)                      
        }    
        else if (screen.height ==600)
        {
           xpos-=60; 
        }
    }
    
    subobj.style.left=xpos+"px"
    subobj.style.top=ypos+"px"
    return false
    }
    else
    return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

function findPosY(obj) 
{
 var curtop, curleft;
 curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {			
			curtop += obj.offsetTop
		}
	}
	
	return curtop;
}

var yScrolled,xScrolled ;

function HowMuchScrolled()
{    
	if (self.pageYOffset) // all except Explorer
	{
		xScrolled = self.pageXOffset;
		yScrolled = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		xScrolled = document.documentElement.scrollLeft;
		yScrolled = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		xScrolled = document.body.scrollLeft;
		yScrolled = document.body.scrollTop;
	}	
}

var theClientWidth, theClientHeight;

function ClientSize()
{
    // Window dimensions: 
    if (window.innerWidth) {
    theClientWidth=window.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth) {
    theClientWidth=document.documentElement.clientWidth;
    }
    else if (document.body) {
    theClientWidth=document.body.clientWidth;
    }
    if (window.innerHeight) {
    theClientHeight=window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
    theClientHeight=document.documentElement.clientHeight;
    }
    else if (document.body) {
    theClientHeight=document.body.clientHeight;
    }
}


