
function igoh(){
$("#gn-igo").remove();
}
function four(){
$("#igo").unbind("blur",igoh);
}
function nour(){
$("#igo").bind("blur",igoh);
}
function igow(){
$("#gn-igo").remove();
var urls=document.location.hostname;
var sq=document.getElementById("igo").value;
if(sq){
$.post("http://www.eken.com/eken/ajaxsearch.php",{sq:sq,cc:Math.random},function(data){
if(data!='0' && data!='2'){

var ajs=eval("("+data+")");
var ajsl=ajs.length;
$("#igo").bind("blur",igoh);
var ihtml='<ul id="gn-igo" class="imsh yin" onmouseover="four()" onmouseout="nour()">';
for(var i=0;i<ajsl;i++){
ihtml=ihtml+'<li><a href="'+ajs[i].href+'"><img src="'+ajs[i].pic+'"><h4>'+ajs[i].product+'</h4><p>'+ajs[i].descr+'</p></a></li>';
}
ihtml=ihtml+'</ul>';
$("#igor").addClass("w980");
$("#igor").append(ihtml);
}
if(data=='0'){
var ihtml='<ul id="gn-igo" class="imsh yin"><li style="text-align:center;"><h4>No shortcut found.</h4></li></ul>';
$("#igor").append(ihtml);
}
})
}
}
function submes(){
var company=$("#company").val();
var country=$("#country").val();
var email=$("#email").val();
var cellphone=$("#cellphone").val();
var message=$("#message").val();
var v=$("#vs").val();
if(company==''){alert("Company name can not be empty!");return false;}
if(country==''){alert("Country can not be empty!");return false;}
if(email==''){alert("Email can not be empty!");return false;}
var patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
 if (!patrn.test(email))
 {alert("Please enter a valid email!");$("#email").val('');return false;}
if(cellphone==''){alert("Cellphone can not be empty!");return false;}
if(message==''){alert("Message can not be empty!");return false;}
var urls=document.location.hostname;
var urls2=document.location.href;
var title=document.title;
var froms=urls2;
var looken=$("#looken").val();
if(looken=='1'){
var reg=new RegExp('"',"g"); //
message=message.replace(reg,'\\"');
var url="http://www.ekengroup.com/eken/message.php?company="+escape(company)+"&email="+escape(email)+"&cellphone="+escape(cellphone)+"&v="+escape(v)+"&message="+escape(message)+"&country="+escape(country)+"&url="+escape(urls)+"&froms="+escape(froms)+"&callback=?";
$.getJSON(url,function(data)
{

if(data.ok=='1'){alert("Information submitted to success! Our staff will contact you as soon as possible");$('#dialog-overlay,#dialog-box').hide();$("#subcn").val('0');$("#looken").val('2');}else{
//alert("Network congestion a bit, could you try to contact other!");
alert("Information submitted to success! Our staff will contact you as soon as possible");
$('#dialog-overlay,#dialog-box').hide();
}
})
}

}
function showvideo(){
$(".vdv").css("display","none");
$("#videos").css("display","block");
}
function closev(){
document.location.reload();
}
function popup(v){//1. Company Name 2. Country 3. Cellphone 4. email 5.Message
	var vmail='';
	if(v=='1'){var vmail='Edison@ekengroup.com';}
    if(v=='2'){var vmail='Support@ekengroup.com';}
	var ihtml='<div id="dialog-overlay" style="display:none;"></div><div id="dialog-box" style="display:block;"><input type="hidden" id="looken" value="1"><ul><li><img src="/image/logo.jpg" style="width:72px;height:72px;position:absolute;left:0;top:10px;"></li><li><h2>Send To</h2><input type="text" id="vmail" value="Edison@ekengroup.com" readonly></li><li><h2>Company Name</h2><input id="company" type="text"></li><li class="rel"><h2>Country</h2><input id="country" type="text" onkeyup="ctls();"><div id="cit"><div id="co"></div></div></li><li><h2>Cellphone</h2><input id="cellphone" type="text"></li><li><h2>Email</h2><input id="email" type="text"></li><li><h2>Message</h2><textarea id="message" cols="60" rows="4" style="height:160px;"></textarea></li></ul><p id="dialog-p">Sales Dept : edison@ekengroup.com&nbsp;&nbsp;+86755-85261055&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p><a id="dialog-a" onclick="submes()">Send Email</a><a id="dialog-close" onclick="dialogclose()">Close</a><input type="hidden" value="'+v+'" id="vs"></div>';
	$("body").append(ihtml);
	$("#vmail").val(vmail);
	var maskHeight = $(window).height();  
	var maskWidth = $(window).width();
	var dialogTop =  $(window).scrollTop() + ($('#dialog-box').height()/6); 
	var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2);
	$('#dialog-overlay').css({height:document.body.scrollHeight*2, width:maskWidth}).show();
	$('#dialog-box').css({top:dialogTop, left:dialogLeft}).show();	
}
function dialogclose(){
$('#dialog-overlay,#dialog-box').hide();
}
var ux=1;
$(document).ready(function(){
	if(ux>1){
$(window).resize(function(){ popup();});
	}
	ux=2;
})
$(document).ready(function(){
//DD_belatedPNG.fix('.ekenlogo');  
$(".wtb tr td").mouseover(function(){
$(this).parent(0).addClass("hcd");
}).mouseout(function(){
$(this).parent(0).removeClass("hcd");
})
})	
function ctls(){
$("#co").remove();
var urls=document.location.hostname;
var sq=document.getElementById("country").value;
if(sq){
	$.post("http://www.eken.com/eken/ajaxcountry.php",{sq:sq,cc:Math.random},function(data){
	if(data!='0' && data!='2'){
		var ajs=eval("("+data+")");
		var ajsl=ajs.length;
		var ihtml='<div id="co">';
		for(var i=0;i<ajsl;i++){
			ihtml=ihtml+'<p>'+ajs[i].country+'</p>';
		}//for
		ihtml=ihtml+'</div>';
		$("#cit").append(ihtml);
		$("#cit p").bind("mouseover",function(){
			$(this).addClass("hcd");
			$("#country").val($(this).html());
		}).bind("mouseout",function(){
			$(this).removeClass("hcd");
		}).bind("click",function(){
			$("#cit").css("display","none");
		});
		$("#cit").css("display","block");
	}//if
	})//post
}//if
}//function	
var urls=document.location.hostname;
var mgt="";
var jishu=0;
function compare(){
	if(jishu<2){
	alert("Please select at least two products!");
	return false;
	}
	$(".tcsu").find("li").siblings(".bss").each(function(){		
			mgt=mgt+$(this).find("p").html()+",";			
	});
	var lan=$("#lan").val();
	$.post("http://www.eken.com/eken/cmpare.php",{lan:lan,mgt:mgt,cc:Math.random},function(data){
	$(".wo").html(data);
	});

}
$(function(){
	$(".tcsu").find("li").live("click",function(){
		var xx=$(this).parent().parent().children(0).html();
		if($("#tsci").val()=='1'){
			$(this).parent().parent().siblings().filter(".occ").hide();
			$(this).parent().parent().show();
			$(".compare").show();
			
		}
		if($(this).attr('class')=="opc"){
			
			if(jishu>=3){
				alert("Compare up to three products!");
				return false;
			}
			$(this).removeClass("opc").addClass("bss");	
			jishu++;
				
		}else{
			$(this).addClass("opc").removeClass("bss");
			jishu--;
			if(jishu<0){jishu=0;}

		}
	});
});
function wpsru(){
	var lan=$("#lan").val();
	$.post("http://www.eken.com/eken/compare2.php",{lan:lan,cc:Math.random},function(data){
	$("body").append(data);
	var maskHeight = $(window).height();  
	var maskWidth = $(window).width();
	var dialogTop =  $(window).scrollTop() + ($('#dialogdiv').height()/6); 
	var dialogLeft = (maskWidth/2) - ($('#dialogdiv').width()/2);
	$('#dialogbg').css({height:document.body.scrollHeight*2, width:maskWidth}).show();
	$('#dialogdiv').css({top:dialogTop, left:dialogLeft}).show();	
	});

}
function dialogc(){
$('#dialogbg,#dialogdiv').remove();
jishu=0;
mgt='';
}

