function launch3d(servername, contactid){
	if (ie||dom){
		if (document.getElementById('z3dhref').innerText!='3D ACTIVE'){
			document.getElementById('z3dhref').innerHTML='<font color=\'#ff0000\'>3D ACTIVE</font>';

			if (contactid != '')
				window3D = window.open('http://' + servername + '.zing.com/registration/session_transition.asp?contactid=' + contactid + '&gotoroom=d_zing_courtyard', '3D', '');
			else
				window3D = window.open('http://' + servername + '.zing.com', '3D', '');
		}
		
		window3D.focus();
	}
}

function openW(mn,rid,did,uid){
	var open = window.open("/instantmessage/im.asp?myname=" + mn + "&receiverid=" + rid + "&datingid=" + did + "&uid=" + uid, mn + rid + "_" + did, "width=245, height=405, resizable=no, scrollbars=no");
	open.focus();
}

function checkemail(email) {
	return (/[\w\-]+(\.[\w\-]+|[\w\-]*)+@[A-Z0-9a-z]+(\.[A-Z0-9a-z\-]+|[A-Z0-9a-z\-]*)*[A-Z0-9a-z]\.((com|net|org|edu|gov|mil|biz|info|name)|[A-Za-z]{2,5})/.test(email))
}

function validate_control(controlname) {
	//Use with radio and checkbox controls only
	for (var x = 0; x < form[controlname].length; x++) {
		if (form[controlname][x].type == 'radio' || form[controlname][x].type == 'checkbox') {
			if (form[controlname][x].checked) {
				return true;
			}
		}
	}
	return false;
}

function CheckAny(thisdoc, mevalue) {
	//checks for "ANY" or "ASK ME"
	if (mevalue != thisdoc[0].value) {
		thisdoc[0].checked = false;
	}
	if (thisdoc[0].checked) {
		for (var i = 0; i < thisdoc.length; i++) {
			if (thisdoc[i].value != thisdoc[0].value)
				thisdoc[i].checked = false;
		}
	}
}

function show_photoalbum(userid) {
	var width = 585;
	var height = 347;
	var screenX = screen.width;
	var screenY = screen.height;
	var adjust = 20;
	var x = (screenX - width)/2;
	var y = (screenY - height)/2 - adjust;
	var evnt;
	if (window.event) {
		if (window.event.shiftKey) {
			var open = window.open('/photoalbum/photoalbum.asp?cid=' + userid);
			open.focus();
		} else if (window.event.ctrlKey) {
			var open = window.open("/photoalbum.old/photoalbum.asp?offset=" + userid,"photoalbum","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height + ",top=" + y + ", left=" + x);
			open.focus();
		} else {
			location.href = '/photoalbum/photoalbum.asp?cid=' + userid;
		}
	} else {
		location.href = '/photoalbum/photoalbum.asp?cid=' + userid;
	}
	return false;
}

function open_photoalbum(url) {
	// code to place the pop up window in the centre of the screen.
	var width = 585;
	var height = 347;
	var screenX = screen.width;
	var screenY = screen.height;

	var adjust = 20;
	var x = (screenX - width) / 2;
	var y = ((screenY - height) / 2) - adjust;

	if (window.event) {
		if (window.event.shiftKey) {
			var open = window.open('/photoalbum/' + url.replace('?offset=<%=Session("ContactID")%>', ''));
			open.focus();
		} else if (window.event.ctrlKey) {
			var open = window.open('/photoalbum.old/' + url,'photoalbum',"toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height + ",top=" + y + ", left=" + x);
			open.focus();
		} else {
			location.href = '/photoalbum/' + url.replace('?offset=<%=Session("ContactID")%>', '');
		}
	} else {
		location.href = '/photoalbum/' + url.replace('?offset=<%=Session("ContactID")%>', '');
	}
	return false;
}

function menu_over(controlname, classname) {
		document.getElementById(controlname).className = classname;
}

function validate_search() {
	if (parseInt(document.quicksearch.agefrom.options[document.quicksearch.agefrom.selectedIndex].text) > parseInt(document.quicksearch.ageto.options[document.quicksearch.ageto.selectedIndex].text)) {
		alert('Please enter a valid age range.');
		document.quicksearch.agefrom.focus();
		return false;
	}
	return true;
}
 function initMe()
 {
    onLoad="MM_preloadImages('/images/menu0_01.gif','/images/menu0_02.gif','/images/menu0_03.gif','/images/menu0_04.gif','/images/menu0_05.gif','/images/lm/menu0_01.gif','/images/lm/menu0_02.gif','/images/lm/menu0_03.gif','/images/lm/menu0_04.gif','/images/lm/menu0_05.gif')";
    navType ="homepage";			
 }
function MM_swapImgRestore() { 
  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_findObj(n, d) { 
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
  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 MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
	 
function loadURL(url) {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
	MM_openBrWindow(url,hours+minutes+seconds,'width=550,height=400,status=yes,scoll=yes')
}
function loadChatURL(url) {
	MM_openBrWindow(url,'flirt','width=550,height=400,status=yes,scoll=yes')
}
 function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
function Gopage(page) { 
  document.Form_Action.page.value=page;
  document.Form_Action.submit();
}