var URL_ROOT;

try{ URL_ROOT = String(document.getElementsByTagName('base').item(0).href).replace(/[^\/]*$/,'');}

catch(EE){ URL_ROOT='/';}

function createXmlObject(){

    var xmlobj = null;

    try{

        if (window.ActiveXObject){

            xmlobj = new ActiveXObject("Microsoft.XMLHTTP");

        }else{

            xmlobj = new XMLHttpRequest(); 

        }

		return xmlobj;

    }

    catch(e){

        alert("Your browser did not support Ajax");

        return false;

    }    

}

function getChecked(name){

/*	getChecked(name): return a comma seperated value (value1,value2,value3...)for all checkbox with same name

name	: name of the checkbox

need to create array of check box with same name like:

<input type=checkbox name='name' value=value1>

<input type=checkbox name='name' value=value2>

<input type=checkbox name='name' value=value3>

*/

	var o=document.getElementsByName(name);

	var i,s,v;

	for(i=0,s='';i < o.length; ++i){

		v=o.item(i);

		if(v.type == "checkbox"){

			if(v.checked) s += ',' + String(v.value);

		}

	}

	return s.substr(1);//remove leading ,

}

//////////////////////

function getIdValuesPair(name){

/*	getIdValuesPair(name): return a comma seperated (id1=value1,id2=value2...) for all input with same name

name	: name of input

need to create array of input with same name like:

<input type=text name='name' id='id1' value=value1>

<input type=text name='name' id='id2' value=value2>

<input type=text name='name' id='id3' value=value3>

*/

	var o=document.getElementsByName(name);

	var s='';

	for(i=0;i<o.length;++i){

		v=String(o.item(i).value);

		if(v != '') s += ',' + o.item(i).id + '=' + v;

	}

	return s.substr(1);

}

//////////////////////

function checkAll(name){

/*	checkAll(name):	mark as checked all checkbox with same name

name	: name of the checkbox

*/

	var o=document.getElementsByName(name);

	var i;

	for(i=0;i < o.length; o.item(i).checked=true, ++i);

}

////////////////////////

function setAll(name,state){

/*	setAll(name,state):	mark all checkbox with same name to the specified state

name	: name of the checkbox

state	: true/false status

*/

	var o=document.getElementsByName(name);

	var i;

	for(i=0;i < o.length; o.item(i).checked=state, ++i);

}



////////////////////////

function clearAll(name){

/*	clearAll(name):	uncheck all checkbox with same name

name	: name of the checkbox

*/

	var o=document.getElementsByName(name);

	var i;

	for(i=0;i < o.length; o.item(i).checked=false, ++i);

}

/////////////

////////////////////////

function resetAllName(name){

/*	resetAllName(name):	set name to empty string to exclude from submitting

name	: name of the checkbox

*/

	var o=document.getElementsByName(name);

	var i;

	for(i=0;i < o.length; o.item(i).name='', ++i);

}

/////////////

function urlgo(page,q){

/*	urlgo(page,q,[<name1,value1>[,..n]][,'-',<namex>[,...n]])

	tell browser to goto specified location

page:	page name to goto

q	:	query string

<name1,value1>:	append parameter name=value to query string q

namex	: chop this parameter from query string q

*/

	var c=arguments.length;

	var re=new RegExp;

	for(i = 2; (argv=String(arguments[i])) != '-' && i < c; ++i){

		re.compile("(?:\\&|^)" + argv + "=[^\\&]*(?=\\&|$)","ig");

		q=q.replace(re,"&");//append to url

		q += "&" + argv + "=" + String(arguments[++i]);

	}

	for(++i; i < c; ++i){ //ignore -, denote a start of chopping parameters)

		argv=String(arguments[i]);

		re.compile("(?:\\&|^)" + argv + "=[^\\&]*(?=\\&|$)","ig");

		q=q.replace(re,"&"); //chop from url

	}

	q=q.replace(/\&{2,}/ig,"&").replace(/(?:^\&|\&$)/ig,"");

	window.location.href=page + "?" + q;

}

///////////////

function urlchop(q){

/*	urlchop(q,[name][,...n])

	chop name from query string q

q	: original query string

name: chop this parameter from q

*/

	var c=arguments.length;

	var re=new RegExp;

	for(i=1; i < c; ++i){ //ignore -, denote a start of chopping parameters)

		argv=String(arguments[i]);

		re.compile("(?:\\&|^)" + argv + "=[^\\&]*(?=\\&|$)","ig");

		q=q.replace(re,"&"); //chop from url

	}

	return q.replace(/\&{2,}/ig,"&").replace(/(?:^\&|\&$)/ig,"");

}

////////////////

function urlformat(q){

/*	urlgo(q,[<name1,value1>[,..n]][,'-',<namex>[,...n]])

	append or chop specified parameters from query string

q				: original query string

<name1,value1>	: append parameter name1=value1 to query string q

namex			: chop this parameter from q

*/

	var c=arguments.length;

	var re=new RegExp;

	for(i = 1; (argv=String(arguments[i])) != '-' && i < c; ++i){

		re.compile("(?:\\&|^)" + argv + "=[^\\&]*(?=\\&|$)","ig");

		q=q.replace(re,"&");//append to url

		q += "&" + argv + "=" + String(arguments[++i]);

	}

	for(++i; i < c; ++i){ //ignore -, denote a start of chopping parameters)

		argv=String(arguments[i]);

		re.compile("(?:\\&|^)" + argv + "=[^\\&]*(?=\\&|$)","ig");

		q=q.replace(re,"&"); //chop from url

	}

	return q.replace(/\&{2,}/ig,"&").replace(/(?:^\&|\&$)/ig,"");

}

/*created by DungHM*/

function hideButton(){

//An button tren thanh cong cu voi doi so la id cua td chua nut	

	argLen = arguments.length;

	for(i=0;i<argLen;i++){

		arg = String(arguments[i]);

		with(parent.banner){

			document.getElementById(arg).style.display="none";

		}

	}

}

function showButton(){	

//Hien button tren thanh cong cu voi doi so la id cua td chua nut	

	argLen = arguments.length;

	for(i=0;i<argLen;i++){

		arg = String(arguments[i]);

		with(parent.banner){

			document.getElementById(arg).style.display="";

		}

	}

}

function oversort(id){

	document.getElementById(id).style.backgroundImage="url(../images/over.gif)";	

}

function outsort(id){

	document.getElementById(id).style.backgroundImage="url(../images/bg-product.gif)";	

}

function contextmenu(id){	

	document.getElementById(id).style.visibility = "visible";

}

function contextout(id){

	document.getElementById(id).style.visibility = "hidden";

}

function checknumber(val){

	if (isNaN(val)){

		alert("Day khong phai la mot so!");

		return false;

	}

	if (val == null || val ==""){

		alert("Ban khong duoc bo trong truong nay!");

		return false;

	}

	return true;

}

var __tested__ = false;

function storeCaret (textEl) {

	__tested__=true;

	if (textEl.createTextRange) {

		textEl.caretPos = document.selection.createRange().duplicate();

	}

}

function insertAtCaret (textEl, text) {

	if(!__tested__) return;

	if (textEl.createTextRange && textEl.caretPos) {

		var caretPos = textEl.caretPos;

		caretPos.text =

		caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?	text + ' ' : text;

		textEl.focus();

	}

	else textEl.value = text;

}

function EnterToBr(){

	if(window.event.keyCode == 13 && ! window.event.shiftKey){

		insertAtCaret(window.event.srcElement,"<br>");

	}

}



//Gui cho nguoi than

function showpopup(url){

	if (url=="") return;

	var content = "<form id='sendform' action='sendto.php' method='post' onSubmit='return checkform(this);'>";

	content += "<table width='100%' style='font-size:11px' bgcolor='#EFEBDE'><tr><td colspan='2' class='boxTitle'><input type='hidden' name='url' value='"+url+"'>G&#7917;i cho b&#7841;n b&#232;</td></tr>";

	content += "<tr><td class='text'>Ng&#432;&#7901;i g&#7917;i:&nbsp;</td><td><input name='sendername' class='inputbox' type='text' style='font-size:11px;width:250px;' value=''></td></tr>";

	content += "<tr><td class='text'>Email ng&#432;&#7901;i g&#7917;i:&nbsp;</td><td><input class='inputbox' name='senderemail' type='text' style='font-size:11px;width:250px;'  value=''></td></tr>";

	content += "<tr><td class='text'>Ng&#432;&#7901;i nh&#7853;n:&nbsp;</td><td><input type='text' class='inputbox' name='receivername' style='font-size:11px;width:250px;'  value=''></td></tr>";

	content += "<tr><td class='text'>Email ng&#432;&#7901;i g&#7917;i:&nbsp;</td><td><input type='text' class='inputbox' name='receiveremail' style='font-size:11px;width:250px;'  value=''></td></tr>";

	content += "<tr><td class='text'>Ghi ch&#250;:&nbsp;</td><td><textarea style='overflow:auto' class='inputbox' name='sendernote' style='font-size:11px;width:250px;height:100px'></textarea></td></tr>";

	content += "<tr><td class='text' colspan='2' style='text-align:center'><input type='submit' value='G&#7917;i &#273;i' style='font-family:tahoma;font-size:11px;border:1px solid #000000'>&nbsp;<input type='button' value='B&#7887; qua' style='font-family:tahoma;font-size:11px;border:1px solid #000000' onClick=\"javascript:closebox('sendtofriend');\"></td></tr></table>";

	content += "</form>";

	if ($('sendtofriend')) document.body.removeChild($('sendtofriend'));

	oDiv = document.createElement('DIV');	

	oDiv.id="sendtofriend";

	oDiv.style.fontSize="11px";

	oDiv.style.border="1pt solid #0A2C6F";

	oDiv.style.padding="0px";

	oDiv.style.position="absolute";

	oDiv.style.textAlign="justify";

	oDiv.style.width="380px";

	oDiv.style.height="150px";

	oDiv.style.top="200px";

	oDiv.style.left="320px";

	oDiv.style.backgroundColor="#FFFFFF";

    oDiv.innerHTML = content;

	oSelect = document.getElementsByTagName("select");

	for(var i=0;i<oSelect.length;i++){

		oSelect[i].style.visibility="hidden";	

	}

	document.body.appendChild(oDiv);	

}



function showpicture(imgsrc){

	if (imgsrc=="") return;

	img = new Image();

	img.src = imgsrc;

	//alert(img.width);

	img.onclick = function (){

    closebox('picturebox');

  }

	img.title = 'Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng';

  img.style.cursor = "pointer";

	if ($('picturebox')) document.body.removeChild($('picturebox'));

	if ($('banner_top')) $('banner_top').style.visibility="hidden";

	oDiv = document.createElement('DIV');

	oDiv.id = "picturebox";

	oDiv.style.zIndex = "1";

	//if (document.all){

    //oDiv.innerHTML = '<div style="display:block;padding:3px 3px 3px 3px;border-bottom:1px solid #7899bb;height:15px;width:'+img.width+'px;text-transform:uppercase;font-weight:bold;text-align:right;"><img src="images/close_box.gif" style="cursor:pointer;" onClick="javascript:closebox(\'picturebox\');" title="Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng"/><div>';

  //}else{

    oDiv.innerHTML = '<div style="display:block;border-bottom:1px solid #7899bb;height:20px;width:'+(img.width)+'px;text-transform:uppercase;font-weight:bold;text-align:right;"><img src="images/close_box.gif" style="cursor:pointer;padding:3px 3px 3px 3px" onClick="javascript:closebox(\'picturebox\');" title="Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng"/><div>';

  //}

	

	//oDiv.innerHTML += "<img src='"+imgsrc+"' style='cursor:pointer;display:block;' title='Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng' onClick=\"javascript:closebox('picturebox');\">";

	oDiv.appendChild(img);

  oDiv.style.border="1px solid #7899bb";

	oDiv.style.padding="0px";

	oDiv.style.position="absolute";

	oDiv.style.width=img.width+"px"//"200px";

	oDiv.style.height=img.height+25+"px"//"10px";

	oDiv.style.top="200px";

	oDiv.style.bottom="200px";

	oDiv.style.left="400px";

	oDiv.style.backgroundColor="#FFFFFF";	

	document.body.appendChild(oDiv);

	oDiv.style.visibility ="hidden";

	fade(oDiv,"visible");

}



function closebox(id){

	oDiv = $(id);	

	if ($('banner_top')) $('banner_top').style.visibility="visible";

	document.body.removeChild(oDiv);	

	oSelect = document.getElementsByTagName("select");

	for(var i=0;i<oSelect.length;i++){

		oSelect[i].style.visibility="visible";	

	}

}



function fade(obj,type) {

	try{

    obj.style.filter="blendTrans(duration=2)";

    // Make sure the filter is not playing.

    if (obj.filters.blendTrans.status != 2) {

        obj.filters.blendTrans.apply();

        obj.style.visibility=type;

        obj.filters.blendTrans.play();

    }

	}catch(e){

		obj.style.visibility="visible";

	};

}



function checkform(oForm){

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	var sender=oForm.senderemail.value;

	var receiver=oForm.receiveremail.value;

	for (var i=0;i<oForm.elements.length-2;i++){

		if (oForm.elements[i].value==""){

			alert("Ban khong duoc de trong truong nay");

			return false;

		}

	}

	if (!regex.test(sender) || !regex.test(receiver)){

		alert("Email khong dung dinh dang");

		return false

	}

	return true;

}	

function loadingbox(){

	this.loading = function (content,width,height){

		if (document.getElementById("loading")){

			document.body.removeChild(document.getElementById("loading"));

		}

		var div = document.createElement("DIV");

		div.setAttribute("id","loading");

		div.innerHTML = content;

		div.style.position = "absolute";

		div.style.left = "400px";

		div.style.bottom = "250px";

		div.style.width = width+"px";

		div.style.height = height+"px";

		div.style.textAlign = "center";

		div.style.verticalAlign = "middle";		

		div.style.padding = "0px";

		div.style.zIndex = 1;

		div.onclick = function (){

			document.body.removeChild(div);

		}

		document.body.appendChild(div);

	}

	this.draw = function (content,width,height){

		if (document.getElementById("loading")){

			document.body.removeChild(document.getElementById("loading"));

		}

		var div = document.createElement("DIV");

		div.setAttribute("id","loading");

		div.innerHTML = content;

		div.style.position = "absolute";

		div.style.left = "400px";

		div.style.bottom = "250px";

		div.style.width = width+"px";

		div.style.height = height+"px";

		div.style.textAlign = "center";

		div.style.verticalAlign = "middle";

		div.style.border = "2px solid #333333";

		div.style.fontColor = "#FFFF00";

		div.style.padding = "0px";

		div.style.zIndex = 1;

		div.style.backgroundColor = "#FFFFCC";

		div.onclick = function (){

			document.body.removeChild(div);

		}

		document.body.appendChild(div);

	}

	this.messagebox = function (content,width,height){

		if (document.getElementById("messagebox")){

			document.body.removeChild(document.getElementById("messagebox"));

		}

		var div = document.createElement("DIV");

		content = content + "<input type = 'button' value = '&nbsp;&nbsp;&nbsp;&#272;&oacute;ng&nbsp;&nbsp;&nbsp;' onClick = \"document.body.removeChild($('messagebox'));\" style='border:1px solid #CCCCCC;'><br/><a href='index.php' style='color:blue;'>http://www.dienthoaitrungtin.com</a><br/>";

		div.setAttribute("id","messagebox");

		div.innerHTML = content;

		div.style.position = "absolute";

		div.style.left = "310px";

		div.style.bottom = "100px";

		div.style.width = width+"px";

		div.style.height = height+"px";

		div.style.textAlign = "center";

		div.style.verticalAlign = "middle";

		div.style.border = "2px solid #333333";

		div.style.fontColor = "#FFFF00";

		div.style.padding = "2px 0px 0px 0px";

		div.style.zIndex = 1;

		div.style.backgroundColor = "#FFFFCC";

		//div.onclick = function (){

			//document.body.removeChild(div);

		//}

		document.body.appendChild(div);

	}

	this.clear = function (){

		var div = document.getElementById("loading");

		if (div){

			document.body.removeChild(div);

		}else{

			return;

		}

		

	}

}

function mediaPreview(url){

	window.open("trial.php?url="+url,null,"height=200,width=200,status=no,toolbar=no,menubar=no,location=no");

}



function checkEmail(form,input){

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if (!regex.test(input)){

		alert("Email khong dung dinh dang");

		return;

	}

	submitTextForm(form,'text','cust-process.php?act=resetpass');

	return true;

}



function vote(f){

	var v = '';

	for(i=0;i < f.elements.length;++i)

		if(f.elements[i].type == 'checkbox' || f.elements[i].type == 'radio'){

			if(f.elements[i].checked)

				v += '&' + f.elements[i].name + '=' + encodeURI(f.elements[i].value);

		}else{

			v += '&' + f.elements[i].name + '=' + encodeURI(f.elements[i].value);

		}

	v = v.substr(1);//exclude leading &

	var sParams = "status=no,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,location=no,height=300,width=500,top=100,left=200";

	var wname = "pollwindow";

	var dest = "poll.php?"+v;

	window.open(dest,wname,sParams);

	return false;

}

function isEmpty(obj){

	var value = obj.value;

	if (value=="" || value == null){

		return false;

	}

	return true;

}

function isEmail(obj){

	var str = obj.value;

	var emailPattern = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if (isEmpty(obj)){

		if (!emailPattern.test(str)){

			return false;

		}

	}	

	return true;

}

function showMenuNode(o){

	var u,v,w,i=0,j=0,k=0;

	v = o.nextSibling;

/*	if(u=v){

		w=u.previousSibling;

		while(w && i<20){

			w.nextSibling.style.display='none';

			w=w.previousSibling;

			++i;

		}

		w=u.nextSibling;

		while(w && i<20){

			w.nextSibling.style.display='none';

			w=w.nextSibling;

			++i;

		}

	}*/

	if(v.style.display=='list-item') v.style.display='none';

	else v.style.display  ='list-item';

	return false;

}

function posX(obj){

	var vX=0;

	if(obj.x)vX=obj.x;

	else if(obj.offsetParent)

		while(obj.offsetParent){

			vX+=obj.offsetLeft;

			obj=obj.offsetParent;

		}

	return vX;

}

function posY(obj){

	var vX=0;

	if(obj.y)vX=obj.y;

	else if(obj.offsetParent)

		while(obj.offsetParent){

			vX+=obj.offsetTop;

			obj=obj.offsetParent;

		}

	return vX;

}

function getCurrentTime(id){

  var d =  new Date();

  var wd = d.getDay();

  switch(wd){

    case 0: wd = 'Ch&#7911; Nh&#7853;t';break;

    case 1: wd = 'Th&#7913; hai';break;

    case 2: wd = 'Th&#7913; ba';break;

    case 3: wd = 'Th&#7913; t&#432;';break;

    case 4: wd = 'Th&#7913; n&#259;m';break;

    case 5: wd = 'Th&#7913; s&#225;u';break;

    case 6: wd = 'Th&#7913; b&#7843;y';break;

  } 

  var dat = d.getDate();

  var mon = d.getMonth()+1;

  var yer = d.getYear();

  var text = wd+',&nbsp;'+dat+'&nbsp;-&nbsp;'+mon+'&nbsp;-&nbsp;'+yer;

  document.getElementById(id).innerHTML = text;

}

function selectText(o){

  var val = o.value;

  if (val == 'Tim kiem...'){

    o.value = '';

  }  

  if ((val!='')&&(val!='Tim kiem...')){

    o.select();

  }  

}

function returnText(o){

  if (o.value=='') o.value = 'Tim kiem...';

}

function getImage(url,pars,target){

  var o =  new createXmlObject();

  url = url+'?'+pars;

  var info = new loadingbox();	

	info.loading("<img src = '"+ROOT+"images/loading.gif' style='padding:0px;'>",185,20);

  o.open('GET',url,true);

  o.onreadystatechange = function(){

    if (o.readyState == 4){

      if (o.status == 200){

        info.clear();      

        $(target).innerHTML = o.responseText; 

      }

    }    

  }	

  o.send(null);		

}

function updatePrice(url){  

  var o = null;

  o = new createXmlObject();

  document.getElementById('content').innerHTML ="";

  o.open('GET',url,true);

  o.onreadystatechange = function (){

    if (o.readyState == 4){

      if (o.status == 200){

        document.getElementById('content').innerHTML = o.responseText;

      }      

    }

    else document.getElementById('content').innerHTML = '&#272;ang c&#7853;p nh&#7853;t d&#7919; li&#7879;u m&#7899;i nh&#7845;t, vui l&#242;ng &#273;&#7907;i trong gi&#226;y l&#225;t...';

  }

  o.setRequestHeader('Cache-Control','no-cache');

  o.send(null);    

}

function showPrice(i){

  i = parseInt(i);

  var url = '';

  switch(i){

    case 2: url = 'stockprice1.php';break;

    default:url = 'stockprice.php'; 

  }

  window.open(URL_ROOT + url,'Banggia','width=1024,height=600,resizable=no,scrollbars=yes,location=yes"');

  return false;

}

function hitcounter(id1,id2){

  document.getElementById(id1).innerHTML = app.online;

  document.getElementById(id2).innerHTML = app.visit;

}

/*---end---*/

function bannerClick(id){

	o = new Image();

    o.src='bannerclick.php?BNid='+id+'&ref='+encodeURI(window.location.href);

}

function openWebLink(o){

	if(o.value != ""){

		if(typeof(o.options[o.selectedIndex].rel) == 'undefined' || o.options[o.selectedIndex].rel == '' || o.options[o.selectedIndex].rel == '_self')

			self.location.href=o.value;

		else

			window.open(o.value,o.options[o.selectedIndex].rel);

	}

}

function printpage(){

	window.print();

}



function closebox(id){

	oDiv=document.getElementById(id);

	document.getElementById('product_img_detail').removeChild(oDiv);	

	oSelect = document.getElementsByTagName("select");

	for(var i=0;i<oSelect.length;i++){

		oSelect[i].style.visibility="visible";	

	}

}



function showRealSize(evt,obj){

//	window.alert(obj.tagName + obj.src);

	oDiv = document.createElement('DIV');

	oDiv.id = "picturebox";

	oDiv.style.zIndex = "1";

	oDiv.innerHTML = '<div class="product_size_true"><strong style="cursor:pointer;padding:7px;font-size:14px;" onClick="closebox(\''+ oDiv.id +'\');" title="Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng">X</strong><div>';

	oDiv.innerHTML += '<' + obj.tagName + ' src="' + obj.src + '" title="Click chu&#7897;t l&#234;n &#7843;nh &#273;&#7875; &#273;&#243;ng" onClick="closebox(\'' + oDiv.id + '\');"/>';

	//oDiv.style.border="1px solid #CCCCCC";

	//oDiv.style.top=posY(obj) + 'px';

	//oDiv.style.left=posX(obj) + 'px';

	//oDiv.style.backgroundColor="#FFFFFF";	

	//document.body.appendChild(oDiv);

	document.getElementById('product_img_detail').appendChild(oDiv);

	try{

		var i,n;

		n=oDiv.filters.length;

		//alert(parseInt(10*Math.random(1,n)));

		i = parseInt(n*Math.random());

		//for(i=0;i < n;++i){

		oDiv.style.visibility='hidden';

		oDiv.filters.item(i).Apply();

		oDiv.style.visibility='visible';

		oDiv.filters.item(i).Play();

		//}

	}catch(e){

		oDiv.style.visibility ="visible";

	}

}





//hongnt viet



function checkLogonForm(o){

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if(o.username.value=="" || o.username.value==null){

		window.alert(T_EMAIL_REQUIRED);

		o.username.focus();

		return false;

	}

	if (!regex.test(o.username.value)){

		window.alert(T_EMAIL_TYPE);

		o.username.focus();

		return false;

	}

	if(o.password.value=="" || o.password.value==null){

		window.alert(T_PASSWORD_REQUIRED);

		o.password.focus();

		return false;

	}

	return true;

}



function checkContactForm(row){	


//name

	if(row.ct_name.value=="" || row.ct_name.value==null){

		window.alert(T_NAME_REQUIRED);

		row.ct_name.focus();

		return false;

	}

	if (isNaN(row.ct_name.value)==false){

		window.alert(T_NAME_TYPE);

		row.ct_name.focus();

		return false;

	}

//email

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if(row.ct_email.value=="" || row.ct_email.value==null){

		window.alert(T_EMAIL_REQUIRED);

		row.ct_email.focus();

		return false;

	}

	if (!regex.test(row.ct_email.value)){

		window.alert(T_EMAIL_TYPE);

		row.ct_email.focus();

		return false;

	}



//content

	if(row.ct_content.value=="" || row.ct_content.value==null){

		window.alert(T_CONTENT_REQUIRED);

		row.ct_content.focus();

		return false;

	}

return true;

}



function  checkSignupForm(rs){	

//name

	if(rs.CSlastname.value=="" || rs.CSlastname.value==null){

		window.alert(T_NAME_REQUIRED);

		rs.CSlastname.focus();

		return false;

	}

	if (isNaN(rs.CSlastname.value)==false){

		window.alert(T_NAME_TYPE);

		rs.CSlastname.focus();

		return false;

	}

//email

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if(rs.CSemail.value=="" || rs.CSemail.value==null){

		window.alert(T_EMAIL_REQUIRED);

		rs.CSemail.focus();

		return false;

	}

	if (!regex.test(rs.CSemail.value)){

		window.alert(T_EMAIL_TYPE);

		rs.CSemail.focus();

		return false;

	}

//pass	

	if(rs.CSpassword.value=="" || rs.CSpassword.value==null){

		window.alert(T_PASSWORD_REQUIRED);

		rs.CSpassword.focus();

		return false;

	}

		if(rs.CSpasswordagain.value=="" || rs.CSpasswordagain.value==null){

		window.alert(T_PASSWORD_REQUIRED);

		rs.CSpasswordagain.focus();

		return false;

	}

	var rs1=rs.CSpassword.value;

	var rs2=rs.CSpasswordagain.value;

	if(rs1!=rs2){

		window.alert(T_PASSWORD_AGAIN);

		rs.CSpasswordagain.focus();

		return false;

	}

return true;

}

function open_win(){

	window.open("http://www.esnc.net/");

}

/*

<PUBLIC:COMPONENT lightweight="true">

<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="hoverClass()" />

<PUBLIC:ATTACH EVENT="onmouseout"  ONEVENT="restore()" />

<SCRIPT LANGUAGE="JavaScript">

   function hoverClass()

   {

	   element.className += '-hover';

	}

   function restore()

   { element.className = String(element.className).replace(/\-hover$/,'');

   }

</SCRIPT>

</PUBLIC:COMPONENT>

*/

function checkLinkForm(row){

//Reciprocal Link URL

	if(row.BNmybanner.value=="" || row.BNmybanner.value==null){

		window.alert(T_LINK_URL);

		row.BNmybanner.focus();

		return false;

	}	

//email

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if(row.BNemail.value=="" || row.BNemail.value==null){

		window.alert(T_EMAIL_REQUIRED);

		row.BNemail.focus();

		return false;

	}

	if (!regex.test(row.BNemail.value)){

		window.alert(T_EMAIL_TYPE);

		row.BNemail.focus();

		return false;

	}

//Site title / Your site URL / Reciprocal Link URL

	if(row.BNdesc.value=="" || row.BNdesc.value==null){

		if(row.BNname.value=="" || row.BNname.value==null){

			window.alert(T_TITLE_REQUIRED);

			row.BNname.focus();

			return false;

		}

		if(row.BNurl.value=="" || row.BNurl.value==null){

			window.alert(T_URL_REQUIRED);

			row.BNurl.focus();

			return false;

		}

	}



	row.CBname.value = row.CBid.options[row.CBid.selectedIndex].text;

	return esnc_aform(row);

}

/*

function getValue(o,id){

	obj = document.getElementById(id);

	obj.value = o.options[o.selectedIndex].text;

}

*/

function checkForm(row){

//name

	if(row.cs_firstname.value=="" || row.cs_firstname.value==null){

		window.alert(T_NAME_REQUIRED);

		row.cs_firstname.focus();

		return false;

	}

	if (isNaN(row.cs_firstname.value)==false){

		window.alert(T_NAME_TYPE);

		row.cs_firstname.focus();

		return false;

	}



	if(row.cs_lastname.value=="" || row.cs_lastname.value==null){

		window.alert(T_NAME_REQUIRED);

		row.cs_lastname.focus();

		return false;

	}

	if (isNaN(row.cs_lastname.value)==false){

		window.alert(T_NAME_TYPE);

		row.cs_lastname.focus();

		return false;

	}

//email

	var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;

	if(row.cs_email.value=="" || row.cs_email.value==null){

		window.alert(T_EMAIL_REQUIRED);

		row.cs_email.focus();

		return false;

	}

	if (!regex.test(row.cs_email.value)){

		window.alert(T_EMAIL_TYPE);

		row.cs_email.focus();

		return false;

	}

//phone

	if(row.cs_phone.value=="" || row.cs_phone.value==null){

		window.alert(T_PHONE_REQUIRED);

		row.cs_phone.focus();

		return false;

	}

	if (isNaN(row.cs_phone.value)==true){

		window.alert(T_PHONE_TYPE);

		row.cs_phone.focus();

		return false;

	}

	return true;

}



function toBookMark(v){

	window.location.href=String(window.location.href).replace(/#.*$/,'')+v;

}





