function checkEmail(email) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
    return (true)
  }
  return false;
}

// Login
//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="#9FCEF0"

var ns6=document.getElementById&&!document.all
var previous='';
var eventobj;

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which)
{
  if (which.style&&intended.test(which.tagName)){
    if (ns6&&eventobj.nodeType==3)
      eventobj=eventobj.parentNode.parentNode
    return true
  }
  else
    return false
}
function openwin(width, height, source,name) 
{
	settings="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height;
	newwin=window.open('/ViewImage.php?src=' + source,name, settings);
}
//Function to highlight form element
function highlight(e){
  eventobj=ns6? e.target : event.srcElement
  if (previous!=''){
    if (checkel(previous))
      previous.style.backgroundColor=''
    previous=eventobj
    if (checkel(eventobj))
      eventobj.style.backgroundColor=highlightcolor
  } else{
    if (checkel(eventobj))
    eventobj.style.backgroundColor=highlightcolor
    previous=eventobj
  }
}

function checkCheckBox(f){
  if (f.agree.checked == false )
  {
    alert('How about to AGREE and check the box?');
    return false;
  }else
    return true;
}


function setCookie(sValue,iMinutes,sDomain) {
	if (iMinutes) {
		var date = new Date();
		date.setTime(date.getTime()+(iMinutes*60*1000))
		var expires = "; expires="+date.toGMTString()
	} else expires = ""
	var sCookieCont="usersessionid="+sValue+expires+"; path=/"
	sCookieCont += sDomain!="" && sDomain ?	" ; domain="+sDomain : " ; domain=isratrance.com";
	document.cookie = sCookieCont
}




// Next function used to open outside links in the website
// Karnaf 03/02/2004
function OpenSiteSubmit(location){ 
	document.opensite.out_link.value = location;
	document.opensite.submit(); 
}
function highlightButton(s) {
  if(event)
    if ("INPUT"==event.srcElement.tagName)
      event.srcElement.className=s
}

//----------------
// Login
//----------------
//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode="always"

var enablefade="yes" //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["no", 5] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="yes" //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength=0.5 //fade in duration for IE, in seconds
var Mozfadedegree=0.05 //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)

function showForm( error ){
	alert(error);
  document.frames("login").document.location = "/quicklogin.php?error=" + error;

}

function displayfadeinbox( error ){
	var ie=document.all && !window.opera
	var dom=document.getElementById
	iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox
	var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
	var docwidth=(ie)? iebody.clientWidth : window.innerWidth
	docheight=(ie)? iebody.clientHeight: window.innerHeight
	var objwidth=objref.offsetWidth
	objheight=objref.offsetHeight
	objref.style.left=docwidth/2-objwidth/2+"px"
	objref.style.top=scroll_top+docheight/2-objheight/2+"px"

	if (showonscroll=="yes")
		showonscrollvar=setInterval("staticfadebox()", 50)

	if (enablefade=="yes" && objref.filters){
		objref.filters[0].duration=IEfadelength
		objref.filters[0].Apply()
		objref.filters[0].Play()
	}
	objref.style.visibility="visible"
	if (objref.style.MozOpacity){
		if (enablefade=="yes")
			mozfadevar=setInterval("mozfadefx()", 90)
		else{
			objref.style.MozOpacity=1
			controlledhidebox()
		}
	}
	else
		controlledhidebox()

	if ( objref.style.visibility == "visible" && error != 1 ){
		document.forms("loginform").elements("user").focus();	
	}

}

function mozfadefx(){
if (parseFloat(objref.style.MozOpacity)<1)
objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
else{
clearInterval(mozfadevar)
controlledhidebox()
}
}

function staticfadebox(){
var ie=document.all && !window.opera
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
objref.style.top=scroll_top+docheight/2-objheight/2+"px"
}

function hidefadebox(){
objref.style.visibility="hidden"
if (typeof showonscrollvar!="undefined")
clearInterval(showonscrollvar)
document.forms("loginform").elements("user").value='';

document.getElementById("loginerror").style.visibility = "hidden";
document.getElementById("loginerror").style.display = "none";



//document.frames("login").document.location = "/quicklogin.php?error=0";
}

function controlledhidebox(){
if (autohidebox[0]=="yes"){
var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
setTimeout("hidefadebox()", delayvar)
}
}

function initfunction(){
setTimeout("displayfadeinbox()", 100);
placeFocus();

}