function errorHandler(msg, url, l){    alert('Message: ' + msg + '\n\nURL: ' + url + '\n\nl: ' + l)}//onerror = errorHandler;function textFocus(field){    if (field.value == field.defaultValue) {        field.value = "";        field.style.color = 'black';    }}function getXMLHttp(){    var xmlHttp;    try {        xmlHttp = new XMLHttpRequest();    }     catch (e) {        try {            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");        }         catch (e) {            try {                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");            }             catch (e) {                alert("Your browser does not support AJAX!");                return false;            }        }    }    return xmlHttp;};function dhtmlLoadScript(url, onload, onLoadFunc){   var e = document.createElement("script");   e.src = url;   e.type="text/javascript";	e.onload=function(){		onload(onLoadFunc)	}   document.getElementsByTagName("head")[0].appendChild(e);}function dynamicCSSLoad(url){	var headID = document.getElementsByTagName("head")[0];         	var cssNode = document.createElement('link');	cssNode.type = 'text/css';	cssNode.rel = 'stylesheet';	cssNode.href = url;	cssNode.media = 'screen';	headID.appendChild(cssNode);}function displayTerms(url) {	$.ui.dialog.defaults.bgiframe = true;	$.ui.dialog.defaults.zIndex = 5000	$(function() {		$("#dialog").dialog({			modal: true		});		$("#dialog").dialog('option', 'show', 'blind', 2000);		$("#dialog").dialog('option', 'hide', 'blind', 2000);		$('#dialog').dialog('option', 'buttons', { "Ok": function() { $(this).dialog("close"); } });		//$('#dialog').dialog('option', 'zIndex', 5000)		//alert($('#dialog').dialog('option', 'zIndex'));	});		$('#dialog').dialog('option', 'width', 600);	$('#dialog').dialog('option', 'height', 480);	$('#dialog').dialog('option', 'position', 'center')	$('#dialog').dialog('open');	$('#dialog').html('<div style="overflow:auto; height:380px; z-index:5001" id="dialog-content"></div>');	$("#dialog-content").load(url,'', displayTermsOnLoad);		//$("#dialog").load('contestWinnerForm.py');}function displayTermsOnLoad() {	var title = $("#dialog-content h1")	$('#dialog').dialog('option', 'title', title.html());	$("#dialog-content h1").replaceWith('');}function displayContest() {	$.ui.dialog.defaults.bgiframe = true;	$.ui.dialog.defaults.zindex = 5000;	$("#contestDialog").css('z-index', 5000);	$("#contestDialog").css('visibility', 'visible');	$('#contestDialog').show('blind', {}, 3000, function (){		setTimeout(function(){			hideContest()		}, 25000)	});}function hideContest() {	if ($('#contestDialog').attr('visibility')!='hidden'){		$("#contestDialog").hide('blind', {}, 3000);		$("#contestDialog").attr({			visibility: 'hidden'		});	}	}function onSearchChange(retType, sbPrefix){    var searchTB = document.getElementById(sbPrefix);    var value = escape(searchTB.value);	 if (searchReady) {	 	if (value.length > 1) {	 		searchReady = false;	 		searchStr = searchTB.value;	 		var xmlHttp = getXMLHttp();	 		xmlHttp.onreadystatechange = function() {	 			if (xmlHttp.readyState == 4) {	 				var searchDiv = document.getElementById(sbPrefix + '-searchSuggest');	 					 				searchDiv.innerHTML = xmlHttp.responseText;	 				reIndex();	 				searchReady = true;	 				if (searchStr != searchTB.value) {	 					onSearchChange(retType, sbPrefix);	 				}	 			}	 		};	 		var url = 'ajax/getSearchResults.py?search=' + value + '&retType=' + retType + '&tbName=' + sbPrefix;	 		xmlHttp.open("GET", url, true);	 		xmlHttp.send(null);	 	}	 	else {	 		 		var searchDiv = document.getElementById(sbPrefix + '-searchSuggest');	 		searchDiv.innerHTML = '';	 			 	}	 }}smallDivHover = false;function mainSearchOnClick(retType, compId){	location.assign(retType + ".py?compId="+compId);	//alert('click')}function mainSearchOnClickMD(retType, compId){	if (smallDivHover == false){		mainSearchOnClick(retType, compId);	}}function mainSearchAddCompClick(tbname){	value = document.getElementById(tbname).value;	location.assign("rate.py?name="+value);	}onLoadArray = [];function onLoadFunc(){	for (i=0;i<onLoadArray.length;i++){		onLoadArray[i]();	}}function winSize() {	/*Function used to return the size of the viewport on the current browser	 * It is made to be effective for most browsers.	 * Returns an array in the form of [width, height]	 */  var myWidth = 0, myHeight = 0;  if( typeof( window.innerWidth ) == 'number' ) {    //Non-IE    myWidth = window.innerWidth;    myHeight = window.innerHeight;  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {    //IE 6+ in 'standards compliant mode'    myWidth = document.documentElement.clientWidth;    myHeight = document.documentElement.clientHeight;  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {    //IE 4 compatible    myWidth = document.body.clientWidth;    myHeight = document.body.clientHeight;  }  return [myWidth, myHeight]}function winnerDialog(key){	$.ui.dialog.defaults.bgiframe = true;	$.ui.dialog.defaults.zIndex = 5000	$(function() {		var wSize = winSize();		$("#dialog").dialog({			modal: true,			width: wSize[0] - 50,			height: wSize[1] - 100,			title:'Congratulations! You\'ve Won!'		});		$('#dialog').dialog('option', 'buttons', { "I'm Not Interested in a Prize": function(){$('#dialog').dialog('close')}, "Submit": function() {			contestSubmit(key)		}});		$('#dialog').dialog('option', {beforeclose: contestCancel})		//$('#dialog').dialog('option', 'zIndex', 5000)		//alert($('#dialog').dialog('option', 'zIndex'));	});		$('#dialog').dialog('option', 'position', 'center')	$('#dialog').dialog('open');	$('#dialog').load('contestWinnerForm.py', '', function() {		winnerDialogCB(wSize[1] - 200)	});		//$("#dialog").load('contestWinnerForm.py');}function winnerDialogCB(height){	$('#dialog').wrapInner('<div style="width:100%;height:'+height+'px;overflow:auto;"</div>')}//onload = function() {//	winnerDialog(2342)//};function contestSubmit(key){	data = {};	$('.contestInput').each(function(){		data[this.name] = this.value;	})	data['isRating'] = 't'	data['key'] = key	//$('#dialog').load('contestWinnerForm.py', data)	$.ajax({		url: 'contestWinnerForm.py',		"data": data,		type: 'post',		success: function(msg) {//			try {//				$(msg).find('script').each(function() {//					var e = document.createElement("script");//					e.type = "text/javascript";//					//alert($(this).text())//					e.appendChild(document.createTextNode($(this).text()));//				$("head")[0].appendChild(e);//				})//			}//			finally {				$('#dialog').html(msg)			//}		}	}		)}function contestCancel(event, ui){	return confirm("Are you sure you don't want to submit for the contest?\n\n Click \"OK\" to continue without submitting.\n\n Click \"Cancel\" to continue submitting your information")}function onEnter(e){	var keynum;	var keychar;		if(window.event) // IE	  {	  keynum = e.keyCode;	  }	else if(e.which) // Netscape/Firefox/Opera	  {	  keynum = e.which;	  }	keychar = String.fromCharCode(keynum);	if (keynum == 13){		return false;	}	else {		return true;	}}function load_and_track_ga() {  var account_id = "UA-9786702-1";  var host = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");  var src = host + 'google-analytics.com/ga.js';    $.getScript(src, function() {      if (typeof _gat != undefined) {        pageTracker = _gat._getTracker(account_id);        pageTracker._trackPageview();      }      else {        throw "_gat is undefined";      }    });  }