﻿// JScript File

if (document.images) {

  image1on = new Image();
  image1on.src = "/images/buttonOn.gif";

  image1off = new Image();
  image1off.src = "/images/buttonOff.gif";
    
}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

function chgBg(aID,imgName) {
    var objB = document.getElementById(aID);
    objB.style.background = "url('/images/" + imgName + "') no-repeat"; 
}

function preloadImages() { 
   if (document.images) { 
       for (var i = 0; i < preloadImages.arguments.length; i++) { 
         (new Image()).src = preloadImages.arguments[i]; 
       } 
   } 
 }

function setHover(id,tagname) {  //fix the :hover pseudoclass in IE6-
    el = document.getElementById(id);
    if(el) {
      tn = el.getElementsByTagName(tagname);
      for(i=0;i<tn.length;i++){
	tn[i].onmouseover= function(){
	  this.className ? this.className += ' sfhover' : this.className = 'sfhover';
	}
	tn[i].onmouseout = function(){
	  this.className = this.className.match(/ over/) ? this.className.replace(/ over/,'') : this.className.replace(/^over/,'');
	}
      }	
    }
  }
  
function openWin(aLink) {
	var positionX = (screen.width - 380) / 2;
	var positionY = (screen.height -380) / 2;	
	
    winP = window.open(aLink,'myWin','top=' + positionY + ', left=' + positionX + ', width=470, height=320,scrollbars=1,resizable=0');
    winP.focus();
}

function openFPE() {
	var positionX = (screen.width - 400) / 2;
	var positionY = (screen.height -400) / 2;	
	
    winP = window.open('/forgotPasswordExpert.aspx','myWin','top=' + positionY + ', left=' + positionX + ', width=400, height=180,scrollbars=0,resizable=0');
    winP.focus();
}

function openFPA() {
	var positionX = (screen.width - 400) / 2;
	var positionY = (screen.height -400) / 2;	
	
    winP = window.open('/forgotPasswordAttorney.aspx','myWin','top=' + positionY + ', left=' + positionX + ', width=400, height=180,scrollbars=0,resizable=0');
    winP.focus();
}

function openGuide(aLink) {
	var positionX = (screen.width - 560) / 2;
	var positionY = (screen.height - 560) / 2;	
	
    winP = window.open(aLink,'myWin','top=' + positionY + ', left=' + positionX + ', width=560, height=560,scrollbars=0,resizable=0');
    winP.focus();
}

function openTCC(aLink) {
	var positionX = (screen.width - 320) / 2;
	var positionY = (screen.height - 320) / 2;	
	
    winP = window.open(aLink,'myWin','top=' + positionY + ', left=' + positionX + ', width=320, height=120,scrollbars=0,resizable=0');
    winP.focus();
}

function openTOU(aLink) {
	var positionX = (screen.width - 560) / 2;
	var positionY = (screen.height - 560) / 2;	
	
    winP = window.open(aLink,'myWin','top=' + positionY + ', left=' + positionX + ', width=560, height=560,scrollbars=1,resizable=0');
    winP.focus();
}

function confirmELDelete() {
    return confirm("Are you sure you want to remove expert from list?");
}

function disableLinks(obj) {
 
    obj.style.color = "#ccc";
    
    /*var linkCollection = document.all.tags("input");
    	
		for (i=0; i<linkCollection.length; i++) {
			linkHold = linkCollection(i);

			if (linkHold.className == 'eaLb' && linkHold.id != obj.id)
			{
				linkHold.disabled = true;
			
				//linkHold.setAttribute("onclick", "return false;");
			}
		}
		
	*/
	
	for (i=0; i<29; i++) {
	    var doc = document.getElementById("ctl00_leftContent_ListView1_ctrl" + i + "_rootLink");
	    
	    if (doc != null) {
	        if (doc.id != obj.id) {
	        doc.disabled = true;
	        }
	    }
	}
}

function TreeNodeCheckChanged(event, control) {    
// Valid for IE and Firefox/Safari/Chrome.    
var obj = window.event ? window.event.srcElement : event.target;    
var source = new String;
source = window.event ? window.event.srcElement.id : event.target.id;    
source = source.replace(control.id + "t", control.id + "n");    
source = source.replace("CheckBox", ""); 
source = source.replace(" ", ""); 
alert(source);
var checkbox = document.getElementById(source);    

alert(obj.tagName + " " + obj.type);
if (checkbox != null && obj.tagName == "INPUT" && obj.type == "checkbox") {        
        __doPostBack(source, "");    
}}  

  function CheckboxClicked(chkevent) 
        {
            // Tested on IE7 and Firefox 3
            var obj;
            try
            {
                obj = window.event.srcElement;
            }
            catch (Error)
            {
              //Using a browser that cannot retrieve srcElement i.e. Firefox 3
              //obj will not have been set, obj = null
            }
                
            if (obj != null)
            {
              //obj is not null, probably using IE
                if (obj.tagName == "INPUT" && obj.type == "checkbox") 
        {
                    __doPostBack(obj.id, "");
                }
            }
            else
            {
              //obj is null, probably using Firefox
                if (chkevent != null)
                {
                    if (chkevent.target.toString() == "[object HTMLInputElement]")
                    {
                        __doPostBack(obj.id, "");
                    }
                }
            }
    }

function raiseAsyncPostback(chkevent) 
{ 

     __doPostBack("ctl00_leftContent_UpdatePanel2", ""); 
}

function CallClick()
{
//document.getElementById('LinkButton1').click(); //ONLY WORK IN IE
//WORK IN ALL BROWSER
window.location.href = document.getElementById('ctl00_leftContent_LinkButton1').href ;
return false;
}

