
var NS = (document.layers)? true:false;
var IE = document.all?true:false;





function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
 }
function popupWin() {
   newWindow = window.open('/popup.htm','newWin','width=300,height=175');
  // setTimeout('windowProp(text)', 3000); 		// delay 3 seconds before opening
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function callURL(src)
{
	var url="";
	url = src.getAttribute("target")
	if (url.length>0){
		window.location.href = url;
	}
}
      
   function openwin(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'titlebar=no, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=710,height=600,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'', myFeatures);
	}
	
	
	
	function openCalPopWin(formName, element) {
		openWinSize('/office/calendar/calpop.asp?FormName=' + formName + '&Element=' + element, 230, 225);
		return false;
	}

	function openWinSize(link, width, height) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 760) / 2) > 0) {
			myLeft = ((screen.width - 760) / 2) + 450
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 500) / 2) > 0) {
			myTop = ((screen.height - 500) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height;

		window.open( link,'mywindow', myFeatures);
	}
   
  function OpenWinCenter(link, width, height) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		myLeft=(screen.width)/2-width/2;
		myTop=(screen.height )/2-height/2;
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,left='+myLeft+', top='+myTop+',scrollbars=yes,resizable=yes,width=' + width + ',height=' + height;
        window_handle=window.open(link,'newwindow',myFeatures);
        window_handle=window_handle.focus();
        return true;
  }
  
  function OpenWinCenter1(link, width, height) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		myLeft=(screen.width)/2-width/2;
		//myTop=(screen.height )/2-height/2;
		myFeatures = 'resizable=no, scrollbars=no,toolbar=no,location=no, directories=no,status=no,menubar=no,left='+myLeft+', top='+myTop+',width=' + width + ',height=' + height;
        window_handle=window.open(link,'newwindow',myFeatures);
        window_handle=window_handle.focus();
        return true;
  }

   function openSmallWin(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=580,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'', myFeatures);
	}
	
	
	function openSmallWin1(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=400,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'mywindow', myFeatures);
	}
	
	 function openSmallWinStatus(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=825,height=500,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'', myFeatures);
	}
	
	   function openLink(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=750,height=400,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'level2Win', myFeatures);
	}


	   function openContactManager1(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=220,height=350,left=' + myLeft + ',top= ' + myTop
		
		window.open( link,'', myFeatures);
	}
	
		
	
   function openSearchWin(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures
		if (((screen.width - 790) / 2) > 0) {
			myLeft = ((screen.width - 760) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 500) / 2) > 0) {
			myTop = ((screen.height - 500) / 2)
		}
		else {
			myTop = 0
		}
		myFeatures = 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=790,height=500,left=' + myLeft + ',top= ' + myTop	
		window.open( link,'level2Win', myFeatures);
	}

   function processForm(formName, formName2) {
	switch (formName)
	{
		case "Google":
			var SearchString = "http://www.google.com/search?q=" + formName2;
			//top.framename.location=SearchString;
			myframehdr="yes";
			openSearchWin(SearchString);
			break;
		case "Yahoo":
			var SearchString = "http://search.yahoo.com/bin/search?p=" + formName2;
			//top.framename.location=SearchString;
			myframehdr="yes";
			openSearchWin(SearchString);
			break;
		case "Excite":
			var SearchString = "http://search.excite.com/search.gw?c=web&search=" + formName2;
			//top.framename.location=SearchString;
			myframehdr="yes";
			openSearchWin(SearchString);
			break;
		case "Alta Vista":
			var SearchString = "http://www.altavista.com/sites/search/web?q=" + formName2;
			//top.framename.location=SearchString;
			myframehdr="yes";
			openSearchWin(SearchString);
			break;
		case "News":
			var SearchString = "http://myetopia.yellowbrix.com/pages/myetopia/Search.nsp?srStart=1&srQuery=" + "'" + formName2 + "'" + "&ID=myetopia&scategory='AP+Top+Headlines'";
			myframehdr="no";
			openSearchWin(SearchString);
			break;
		case "People":
			var SearchString = "http://myetopia.yellowbrix.com/pages/myetopia/PeopleSearch.nsp?start=1&srQuery=" + "'" + formName2 + "'" + "&ID=myetopia&tickerlist=&scategory=AP+Top+Headlines";
			myframehdr="no";
			openSearchWin(SearchString);
			break;
		case "Stocks":
			var myname = formName2
			var mylength = myname.length
			if (mylength > 4) {
				var SearchString = "http://myetopia.yellowbrix.com/pages/myetopia/coQuote.nsp?quoteLookup=1&by name=" + formName2 + "&byNameTicker=name&id=myetopia"
			}		
			else {
				var SearchString = "http://myetopia.yellowbrix.com/pages/myetopia/coQuote.nsp?quoteLookup=1&by name=" + formName2 + "&byNameTicker=ticker&id=myetopia"
			}
			myframehdr="no";
			openSearchWin(SearchString);
			break;
		case "Companies":
			var SearchString = "http://myetopia.yellowbrix.com/pages/myetopia/coOverview.nsp?found=1&by_name=" + formName2 + "&ID=myetopia&tickerlist=&scategory=AP+Top+Headlines&x=16&y=8";
			myframehdr="no";
			openSearchWin(SearchString);
			break;
		case "Learning Center":
			var SearchString = "/Applications/LearningCenter/query.asp?qu=" + formName2 + "&sc=/Applications/LearningCenter&RankBase=1000";
			myframehdr="no";
			openSearchWin(SearchString);
			break;
		default:
			alert("Sorry, not yet available.");
			break;
	}
   }
   
   function setMouseOver(txt)
	{
		window.status = txt;
		return true;
	}

	function clearMouseOver()
	{
		window.status='';
		return true;
	}

	function openTinyWin(link) {
		var myLeft = 0
		var myTop = 0
		var myFeatures

		if (((screen.width - 700) / 2) > 0) {
			myLeft = ((screen.width - 700) / 2)
		}
		else {
			myLeft = 0
		}
		if (((screen.height - 450) / 2) > 0) {
			myTop = ((screen.height - 450) / 2)
		}
		else {
			myTop = 0
		}

		myFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=330,left=' + myLeft + ',top= ' + myTop

		window.open( link,'', myFeatures);
		
	}
	
	function checkdate(objName) {
		var datefield = objName;
		if (chkdate(objName) == false) {
			datefield.select();
			alert("Invalid date!");
			datefield.focus();
			return false;
			}
		else {
			return true;
			}
	}
	
	function quit()
	{
		//alert("quit");
		setTimeout("closewindow()",1000);
	}

	function closewindow()
	{
	//alert("close");
	window.close();
	}
	
	
	function chkdate(objName) {
		var strDatestyle = "US"; //United States date style
		//var strDatestyle = "EU";  //European date style
		var strDate;
		var strDateArray;
		var strDay;
		var strMonth;
		var strYear;
		var intday;
		var intMonth;
		var intYear;
		var booFound = false;
		var datefield = objName;
		var strSeparatorArray = new Array("-"," ","/",".");
		var intElementNr;
		var err = 0;
		var strMonthArray = new Array(12);
		strMonthArray[0] = "Jan";
		strMonthArray[1] = "Feb";
		strMonthArray[2] = "Mar";
		strMonthArray[3] = "Apr";
		strMonthArray[4] = "May";
		strMonthArray[5] = "Jun";
		strMonthArray[6] = "Jul";
		strMonthArray[7] = "Aug";
		strMonthArray[8] = "Sep";
		strMonthArray[9] = "Oct";
		strMonthArray[10] = "Nov";
		strMonthArray[11] = "Dec";
		strDate = datefield.value;
		if (strDate.length < 1) {
		return true;
	}
	
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
		strDateArray = strDate.split(strSeparatorArray[intElementNr]);
		if (strDateArray.length != 3) {
		err = 1;
		return false;
		}
		else {
		strDay = strDateArray[0];
		strMonth = strDateArray[1];
		strYear = strDateArray[2];
		}
		booFound = true;
		 }
		}
		if (booFound == false) {
		if (strDate.length>5) {
		strDay = strDate.substr(0, 2);
		strMonth = strDate.substr(2, 2);
		strYear = strDate.substr(4);
		}
		}
		if (strYear.length == 2) {
		strYear = '20' + strYear;
		}
		// US style
		if (strDatestyle == "US") {
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
		}
		intday = parseInt(strDay, 10);
		if (isNaN(intday)) {
		err = 2;
		return false;
		}
		intMonth = parseInt(strMonth, 10);
			if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
		if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
		intMonth = i+1;
		strMonth = strMonthArray[i];
		i = 12;
		 }
		}
		if (isNaN(intMonth)) {
		err = 3;
		return false;
		}
		}
		
		if ( isNaN(Number(strYear,10))) {
		    //alert("Here");
			err=100;
		  return false;
		}
		
		intYear = parseInt(strYear, 10);
		//alert(Number(strYear,10));
		if (isNaN(intYear)) {
		err = 4;
		return false;
		}
		if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
		}
		if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
		}
		if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
		}
		if (intMonth == 2) {
		if (intday < 1) {
		err = 8;
		return false;
		}
		if (LeapYear(intYear) == true) {
		if (intday > 29) {
		err = 9;
		return false;
		}
		}
		else {
		if (intday > 28) {
		err = 10;
		return false;
		}
		}
		}
		if (strDatestyle == "US") {
		//datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
		}
		else {
		//datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
		}
		return true;
		}
		function LeapYear(intYear) {
		if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
		}
		else {
		if ((intYear % 4) == 0) { return true; }
		}
		return false;
		}
		function doDateCheck(from, to) {
		if (Date.parse(from.value) <= Date.parse(to.value)) {
		alert("The dates are valid.");
		}
		else {
		if (from.value == "" || to.value == "") 
		alert("Both dates must be entered.");
		else 
		alert("To date must occur after the from date.");
		}
	}

	function supressError() {
    return true;
  }

   function load(url) {
    window.onerror = supressError;
    opener.location.href = url;
    setTimeout('self.close()',1000);
  }
  

// function for highlighting menu items
function mouseOvrOut(src,pColor,pOvr) {
 //alert( src.id)
 if (pOvr=1 )
 {
	src.style.cursor = 'hand';
 }
 else
 {
    src.style.cursor = 'default';
 }
 src.style.backgroundColor =  pColor;
}

function SetFocus(src){
	var whichkey = (NS) ? e.which : event.keyCode; 
	if (whichkey == 13){ 
		src.focus();
	}
}
	
function AdjLeftNavBottomHeight(){
	//document.all.leftNavBottom.style.posHeight = document.all.dlProductFamily1.offsetHeight;
	var oLeftBottom=document.getElementById("leftNavBottom");
	var oLstProductFamily = document.getElementById("lstSecondary");
	var oLstProductModule = document.getElementById("lstPrimary");
	var oTblProductBody =document.getElementById("pnlBody");
	var oGrdProduct = document.getElementById("ctrl2ndLevel_grdProduct");
	var oLeftNav = document.getElementById("tblLeftNav");
	var oTblFoot = document.getElementById("tblFoot");
	var h =3500;
	/*
	if (NS){
		oLeftBottom = document.layers["leftNavBottom"];
		oLstProductFamily = document.layers["dlProductFamily1"];
		oLstProductModule = document.layers["dgProductModule"];
		oTblProductBody = document.layers["tblProductBody"];
	}
	else if (IE){
		oLeftBottom = document.all["leftNavBottom"];
		oLstProductModule = document.all["dgProductModule"];
		oLstProductFamily = document.all["dlProductFamily1"];
		oTblProductBody = document.all["tblProductBody"];
		//document.all.leftNavBottom.style.Height = document.all.dlProductFamily1.offsetHeight+document.all.dlProductFamily1.offsetTop-150;
		//alert(document.all.leftNavBottom.offsetHeight);
	}
	*/
   //alert(oLeftBottom);
	//alert(oLstProductFamily);
	//alert(oLstProductModule);
	//alert(oTblProductBody);
	//alert(oTblProductBody.offsetHeight);
	//alert(oGrdProduct);
	if (oLeftBottom !=null && (oLstProductFamily !=null || 
		oLstProductModule !=null || oTblProductBody !=null || oGrdProduct!=null)){
		//alert(oGrdProduct.offsetTop);
		if (oLstProductFamily !=null && oLstProductModule !=null){
			h = oLstProductFamily.offsetHeight+oLstProductModule.offsetHeight+100;
		}
		else if (oLstProductFamily !=null ){
			h = oLstProductFamily.offsetHeight+oLstProductFamily.offsetTop;
		}
		else if (oLstProductModule !=null){
			h = oLstProductModule.offsetHeight+oLstProductModule.offsetTop;
		}
		//else if (oTblProductBody !=null){
		//	h = oTblProductBody.offsetHeight+oTblProductBody.offsetTop;
		//}
		else if (oGrdProduct!=null){
			//h = oTblProductBody.offsetHeight+oGrdProduct.offsetHeight-300;
			h = oGrdProduct.offsetHeight;
			if (oGrdProduct.offsetHeight>300){
				h = oGrdProduct.offsetHeight-300;
			}
			//alert(h);
			//alert(oGrdProduct.offsetHeight);
		}
		oLeftBottom.style.height = h;
	}

	AdjToolBarLeft();
}

	
function AdjToolBarLeft(){
   if (IE){
		if (document.all["tblLeftNav"]!=null)
			document.all["tbarTop"].style.width = document.all["tblLeftNav"].offsetWidth-3;
   }
   else if (NS){
		if (document.layers["tblLeftNav"]!=null)
			document.layers["tbarTop"].style.width = document.layers["tblLeftNav"].offsetWidth-3;
   }
	//alert(document.all["tbarTop"].offsetWidth);
}

 //add function for literature request
function check_applications(sender, args){
	if (document.getElementById("MarketIndustryJob1_applications_ID").selectedIndex == 0  || document.getElementById("MarketIndustryJob1_applications_ID").selectedIndex == -1 ) 
	{  
		args.IsValid = false;
		return true;
	}
	args.IsValid = true;

}
		 
function check_state(sender, args){
	if (document.getElementById("State").selectedIndex == 0  || document.getElementById("State").selectedIndex == -1 ) 
	{  
		args.IsValid = false;
		return true;
	}
	args.IsValid = true;

}
		
		 
		
function check_checkboxlist(checkBoxListId, num, checkBoxId)
{
// Get the checkboxlist object.

	objCtrl = document.getElementById(checkBoxListId);

	
	// Does the checkboxlist not exist?
	if(objCtrl == null)
	{        return;
	}
	var i = 0;

	var check = 0;
	
	// iterate through checkboxlist 
	for(i = 0; i<num; i++)
	{
		if(document.getElementById(checkBoxListId + '_' + i).checked)
		{
				check=1
		}
	}

	if (check)
	{
		document.getElementById(checkBoxId).checked = true;
	}
	else
	{
		document.getElementById(checkBoxId).checked = false;
	}
		
}

// remove White Space from start and/or end of given string
String.prototype.trim  = _trim;

/**
  * remove White Space from start and/or end of given string
  * White Space is defined as:
  *         - Space
  *        - Carriage Return
  *        - newline
  *        - form feed
  *        - TABs
  *        - Vertical TABs
  **/

function _trim ( )
{
   //   /            open search
   //     ^            beginning of string
   //     \s           find White Space, space, TAB and Carriage Returns
   //     +            one or more
   //   |            logical OR
   //     \s           find White Space, space, TAB and Carriage Returns
   //     $            at end of string
   //   /            close search
   //   g            global search

   return this.replace(/^\s+|\s+$/g, "");
}


function getOffsetTop (el) {
  var ot = el.offsetTop;
  var sl = el;
  var sh = 0;
  while((el = el.offsetParent) != null){
       ot += el.offsetTop;
       if(el.offsetParent && el.offsetParent.offsetParent){
	     var scrollTop = el.offsetParent.scrollTop;
         if(!isNaN(scrollTop)) sh -= scrollTop;
      }
   }
   el = sl;
   if(NS){
        while((el = el.parentNode) != null){
             if(el.parentNode && el.parentNode.parentNode
                && !(el.parentNode.tagName && 
el.parentNode.tagName.toUpperCase() == "BODY")){
      	        var scrollTop = el.parentNode.scrollTop;
                if(!isNaN(scrollTop) && scrollTop > 0 ){
                   sh -= scrollTop;
                }
            }
        }
   }
  return ot + sh;
}

function getOffsetLeft (el) {
  var sl = el;
  var ol = el.offsetLeft;
  var sh = 0;
  while ((el = el.offsetParent) != null){
    ol += el.offsetLeft;
     if(el.offsetParent && el.offsetParent.offsetParent){
     var scrollLeft = el.offsetParent.scrollLeft;
       if(!isNaN(scrollLeft)){
         sh -= scrollLeft;
       }
    }
  }

   el = sl;
   if(NS){
        while((el = el.parentNode) != null){
             if(el.parentNode && el.parentNode.parentNode
                && !(el.parentNode.tagName && 
el.parentNode.tagName.toUpperCase() == "BODY")){
      	        var scrollLeft = el.parentNode.scrollLeft;
                if(!isNaN(scrollLeft) && scrollLeft > 0 ){
                   sh -= scrollLeft;
                }
            }
        }
   }
  return ol+sh;
}

function getElementHeight(Elem) {
//	if (ns4) {
//		var elem = getObjNN4(document, Elem);
//		return elem.clip.height;
//	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
//		if (op5) { 
//			xPos = elem.style.pixelHeight;
//		} else {
			//xPos = elem.offsetHeight;
//		}
		return elem.offsetHeight;
//	} 
}

function getElementWidth(Elem) {
//	if (ns4) {
//		var elem = getObjNN4(document, Elem);
//		return elem.clip.width;
//	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
//		if (op5) {
//			xPos = elem.style.pixelWidth;
//		} else {
			//xPos = elem.offsetWidth;
//		}
		return elem.offsetWidth;
//	}
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}
function elementTop(eSrc)
{
	var iTop = 0;
	var eParent;
	eParent = eSrc;
	while (eParent.tagName.toUpperCase() != "BODY")
	{
		iTop += eParent.offsetTop;
		eParent = eParent.offsetParent;
	}
	return iTop;
}
function elementLeft(eSrc)
{
	var iLeft = 0;
	var eParent;
	eParent = eSrc;
	while (eParent.tagName.toUpperCase() != "BODY")
	{
		iLeft += eParent.offsetLeft;
		eParent = eParent.offsetParent;
	}
	return iLeft;
}	
function elementContains(elmOuter, elmInner)
{
  while (elmInner && elmInner != elmOuter)
  {
    //alert(elmInner.parentNode.tagName);
    elmInner = elmInner.parentNode;
  }
  if (elmInner == elmOuter)
  {
    return true;
  }
  return false;
}
	function HideTopMenu(e,parentEle){
//	alert(e+","+parentEle);
//		var i=1;
		var p = document.getElementById(parentEle);
    	var relatedTarget = null;
		relatedTarget = e.relatedTarget || e.originalTarget || e.toElement;
		/*
           if (window.event)
          {
            relatedTarget = window.event.toElement;
          }		
        else if (e)
        {
        	relatedTarget = e.relatedTarget;
            // work around Gecko Linux only bug where related target is null
            // when clicking on menu links or when right clicking and moving
            // into a context menu.
		    if (navigator.product == 'Gecko' && navigator.platform.indexOf('Linux') != -1 && !relatedTarget)
		    {
	    	  relatedTarget = e.originalTarget;
		    }
          }

		*/
	      var ele =e.srcElement || e.currentTarget || e.target;
//		  if (parentEle=="ALL"){
//		  alert(ele.tagName+","+relatedTarget.tagName+","+event.srcElement.tagName+","+window.event.toElement.tagName);
//		  }

//alert(relatedTarget.tagName+","+ elementContains(ele, relatedTarget));
//alert(event.srcElement.parentNode.id);
//alert("b,"+relatedTarget.tagName+","+ele.parentNode.id);
		if (parentEle!="ALL"){
        	if (elementContains(p, relatedTarget))
          	{
		    	//alert('hhh');
            	return false;
	        }
		}


		//alert(ele.parentNode.id);
		if (ele.parentNode.id!=parentEle || parentEle=="ALL"){
		for (var i=1;i<8;i++){
			var mnu = document.getElementById("mnu"+i);
			if (mnu!=null){
				mnu.style.display="none";
				mnu.style.visibility="hidden";
			}
		}
		}
	}
	
 	function ShowTopMenu(e,id,parentEle){
		HideTopMenu(e,"ALL");
		//alert('show');
		var mnu = document.getElementById(id);
		var p = document.getElementById(parentEle);
		var t =0;
//		alert(id+","+parentEle);
		//alert(mnu.style.display+","+mnu.style.visibility);
		if (mnu!=null){
		    
			if (mnu.style.display=="none"){
				mnu.style.display="";
//				mnu.style.position="absolute";
				mnu.style.left = elementLeft(p)+"px";
				t =elementTop(p)+p.offsetHeight+"px";
//				alert(t);
				mnu.style.top = t;
//				mnu.style.zIndex=0;
				mnu.style.visibility = "visible";
			}
//			alert(mnu.style.left+","+mnu.style.top+","+elementTop(p)+","+p.offsetHeight);
		}
	}

// function for highlighting menu items
function mOvr(e,src) {

	if (!elementContains(src, e.fromElement)){
	//if (!src.contains(e.fromElement)) {
		//src.style.cursor = 'hand';
		src.style.cursor = 'pointer';
		//src.bgColor = '#65b1e7';
		src.bgColor = '#3399FF';
	
		//src.children.tags('A')[0].style.color = '#000000';
		if (src.children!=null){
		src.children.tags('A')[0].style.color = '#ffffff';
		if (src.children.tags('A')[1]){
			src.children.tags('A')[1].style.color = '#ffffff';
		}
		}
	}
}

// function for highlighting menu items
function mOut(e,src) {
	var relatedTarget = e.relatedTarget || e.originalTarget || e.toElement;
	if (!elementContains(src, relatedTarget)){
	//if (!src.contains(ele)) {
		src.style.cursor = 'default';
		src.bgColor = '#ffffff';
		
		if (src.children!=null){
		src.children.tags('A')[0].style.color = '#666666';
		if (src.children.tags('A')[1]){
		src.children.tags('A')[1].style.color = '#666666';
		}
		}
	}
}

// function for clicking a menu item
function mClk(e,src) {
	if(e.srcElement.tagName=='TD') {
		src.children.tags('A')[0].click();
	}
}

function ShowHideDiv(src,srcToShow){
	if (src!=null){
			if (src.style.display==""){
			src.style.display="none";
			srcToShow.style.display="";
			img =document.getElementById("imgMoreInfo");
			if (img!=null){
				img.style.display="none";
			}
		}
		else{
			src.style.display=""; 
			srcToShow.style.display="none";
		}
	}
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function getQueryVariableByString(variable, str) {
  var query = str.substring(str.indexOf("?")+1);
  //alert(query);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function AddItem(url){
	var ranNum = Math.round(Math.random()*100);
   //var dt = new Date().valueOf();
	var dt1 = new Date("01/01/2000 12:00:00 AM");
   var dt2 = new Date();
   //var uId =(dt2.valueOf()-dt1.valueOf());
	var uId =(dt2.valueOf()-dt1.valueOf())*ranNum;
   //alert((dt2.valueOf()-dt1.valueOf())*ranNum);
   //var uId =DateDiff("s", "01/01/2000 12:00:00 AM", Date() & " " & Time());
   
	window.location.href=url+"&productBuyUid="+uId;
}

function IsNumeric(str)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
	var i=0;
  
	if (str.trim().length>0){

		for (i = 0; i < str.length && IsNumber == true; i++) 
			{ 
			Char = str.charAt(i); 
			if (ValidChars.indexOf(Char) == -1) 
				{
				IsNumber = false;
				break;
				}
			}
	}
	else{
		IsNumber=false;
	}


   return IsNumber;
}

function validate(obj){
		if (!IsNumeric(obj.value) && obj.value.length>0){
			Ext.fly(obj).frame('red',1);
			var o = Ext.get(obj);
			setTimeout(function(){
				if (o.isVisible()){
					o.focus();
				}
			},500);
		}
		}
		
		
function GetUId(){
	var ranNum = Math.round(Math.random()*100);
   
	var dt1 = new Date("01/01/2000 12:00:00 AM");
   var dt2 = new Date();
   
	var uId =(dt2.valueOf()-dt1.valueOf())*ranNum;

	return uId;
}


function openVideos(popurl){
		winpops=window.open(popurl,"","width=640,height=406,")
	}
	
	

function openVideosSize(popurl,width,height){
		winpops=window.open(popurl,"","width="+width+",height="+height);
	}
	
function EnterkeyPress(e) { 
      
        if(e!=null && e && e.which){ //if which property of event object is supported (NN4)
			e = e
		    characterCode = e.which //character code is contained in NN4's which property
		}
		else if (e!=null && e.which){
			characterCode = e.which
		}
		else{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		}
			 
        if (e.keyCode == 13) { 
           
            
              DoSearch();
				
             //  document.getElementById("header1_Submit").click(); 
           
          return false;
                    
        } 
             
 } 


function DoSearch(){
    var tf = document.getElementById("header1_searchbox");
    var rd0=document.getElementById("header1_searchtype_0");
    var rd1=document.getElementById("header1_searchtype_1");
    var lb=document.getElementById('header1_dlLang');
    
    var type=0,search,lang
    
    if(rd1.checked){
       type=1
    }
   
    
    switch (lb.value){
		case '1033':
		   lang='1033';
		   break
	   case '1036':
		   lang='1036';
		   break
	   case '1031':
			lang='1031';
			break
	  default:
			lang='1033';
    }
	
    if (tf!=null && tf.value!=''){
       search=tf.value;
       window.location.href ='/searchresults.aspx?searchfor='+search+'&lang='+lang+'&type='+type
    }
   
}
              
function clickHightLight() { 
                    var tf = document.getElementById("header1_searchbox");
						  tf.focus();
						  tf.select();
              } 
	
	
function selectlang(lang)
{
 if (lang!=null)
 {
   var link;
     link=document.getElementById('header1_HyperLink'+lang.value);
    
    
     if (link!=null && link !='')
      {
         window.location.href =link.href;
      }
    
     
 }
 
 

}


 function bookmark(url,title){
			if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
				 window.external.AddFavorite(url,title);
			} 
			else if (navigator.appName == "Netscape") {
				 window.sidebar.addPanel(title,url,"");
			} 
			else {
				alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
			 }
			}


/***********************************************
* DHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function domticker(content, divId, divClass, delay, fadeornot){
this.content=content
this.tickerid=divId //ID of master ticker div. Message is contained inside first child of ticker div
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=1
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>')
var instanceOfTicker=this
setTimeout(function(){instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize=function(){
var instanceOfTicker=this
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}

domticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.content[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.content.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

domticker.prototype.fadetransition=function(fadetype, timerid){
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.2
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}



function ShowLeftNavMenu(src){
	var mnu = document.getElementById("pnlTreeList");
	var imgHead = document.getElementById("imgBtnHead");
	var mnuHead = src;
		if (mnu!=null){
			   if (mnu.style.display==""){
						mnu.style.display="none";
						imgHead.src = "/common/images/arrow_right_square_darkorange.gif";
						
				}
				else{
					mnu.style.position="absolute";
					mnu.style.left=elementLeft(mnuHead)+"px";
					mnu.style.top = elementTop(mnuHead)+mnuHead.offsetHeight+"px";
					mnu.style.display="";
					imgHead.src = "/common/images/arrow_down_square_darkorange.gif";
					}
				}
}


