
<!--



function uniqueval()

{ var date = new Date() ; return date.getTime(); }



//var im_refresh = 5000; 

var session_timeout = 0;

//var im_start_time = uniqueval();

var time_elapsed;

var wincount = 1;

//var newimwin = new Array();



//var newim = 0;

//var im_id = 0;

//var imcheckimg = new Image;

var unique = uniqueval();
/*
function new_message()

{

   im_id = imcheckimg.width;

   var unique = uniqueval();

   newimwin[wincount] = window.open("im.php?id="+im_id, unique, 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=450,height=350');

   newimwin[wincount].focus();

   wincount++;

}

function newimcheck()

{

   newim = imcheckimg.height;

   if(newim == 2)

      new_message();

}

function imcheck()

{
/*
   var unique = uniqueval();

   time_elapsed = unique - im_start_time;

   if(time_elapsed > 7200000)

      session_timeout = 1;



   imcheckimg = new Image ;

   imcheckimg.src = "imcheck.php?user=Guest65167&uniqueval="+unique;

   imcheckimg.onload = newimcheck;

   if(session_timeout == 0)

      setTimeout("imcheck()",im_refresh);

}

function write_message(username)

{

   var unique = uniqueval();

   newimwin[wincount] = window.open("im.php?action=writenew&user="+username, unique, 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=450,height=350');

   newimwin[wincount].focus();

   wincount++;

}






function changestat(mess)

{

  window.status="";

  window.status=mess;

}



function changeback()

{

  window.status="";

}



function addfriend(username)

{

   var unique = uniqueval();

   newfwin = window.open("addfriend.php?friend="+username, unique, 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=200,height=200');

   newfwin.focus();

}

*/

function addhot(username)

{

   var unique = uniqueval();

   newfwin = window.open("addhotlist.php?hotuser="+username, unique, 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=200,height=200');

   newfwin.focus();

}



function lostpass() {

lostpasswin = window.open('lostpassword.php', 'lostpass', 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=200,height=200');

lostpasswin.focus();

}

function disablepass(cbox) {

box = eval(document.imageform.primarypic);

if (box.checked) {

document.imageform.passcheck.checked="";

document.imageform.passcheck.disabled="disabled";

document.imageform.password.disabled="disabled";

document.imageform.password.value="";

}

if (!box.checked) {

document.imageform.passcheck.checked="";

document.imageform.passcheck.disabled="";

document.imageform.password.disabled="";

document.imageform.password.value="";

}



}

function disableprimarypic(cbox) {

box = eval(document.imageform.passcheck);

if (box.checked) {

document.imageform.primarypic.checked="";

document.imageform.primarypic.disabled="disabled";

}

if (!box.checked) {

document.imageform.primarypic.checked="";

document.imageform.primarypic.disabled="";

}

}

function clearCLPBRD(){
	window.clipboardData.setData('text','')
	}

function presence_select(thisForm, elem)
{
  var el = thisForm.elements[elem];
 for (var i=0;i<el.length;i++)
	{
  	 if (el[i].selected && el[i].value != "") return true;
	}  
   return false;
}

function presence_radio(thisForm, elem)
{
  var el = thisForm.elements[elem];
 for (var i=0;i<el.length;i++)
	{
  	 if (el[i].checked) return true;
	}  
   return false;
}

function get_selected_value(thisForm, elem)
{
  var el = thisForm.elements[elem];
 for (var i=0;i<el.length;i++)
	{
  	 if (el[i].selected && el[i].value != "") return el[i].value;
	}  
   return false;
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

<!-- Original:  Brian Swalwell -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=10) {
alert("Please enter your 5 digit or 5 digit+4 zip code.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
return false;
   }
}
return true;
}
//  End -->

function validate(thisForm) {
	with (thisForm) {
	
		var alertMessage = "The following required fields have been left empty:\n";
		if (f_name.value == "") alertMessage += "\nFirst name";
		if (l_name.value == "") alertMessage += "\nLast name";
		if (email.value == "") alertMessage += "\nEmail";
		if (!isValidEmail(email.value)) alertMessage += "\nEmail is Invalid";
		if (username.value == "") alertMessage += "\nUsername";
		if (!presence_radio(thisForm, 'sex')) alertMessage += "\nSex";
		if (!presence_radio(thisForm, 'seeking')) alertMessage += "\nSeeking";
		if (!presence_select(thisForm, 'location') || get_selected_value(thisForm, 'location') == "0") alertMessage += "\nLocation";
		if (city.value == "") alertMessage += "\nCity";
		if (presence_select(thisForm, 'location') && get_selected_value(thisForm, 'location') != "0" && get_selected_value(thisForm, 'location') != "1") {
			if (zip.value == "") alertMessage += "\nZip";
			if (!validateZIP(zip.value)) return false;
		}
		if (alertMessage != "The following required fields have been left empty:\n") {
			alertMessage += "\n\nPlease fill out all required fields and try again.";
			alert(alertMessage);
			return false;
		} else return true;
	}
}
//-->
//Code added by Rishikesh for Task #28
function select_all(frm){
	element_number = frm.elements.length ;
	for(i=0; i<element_number; i++){
		if (frm.elements[i].type=="checkbox"){
			frm.elements[i].checked = 1;
		}
	}
}
function unselect_all(frm){
	element_number = frm.elements.length ;
	for(i=0; i<element_number; i++){
		if (frm.elements[i].type=="checkbox"){
			frm.elements[i].checked = 0;
		}
	}
}