var isondiv = 0;
var isondiv2 = 0;
var isondiv3=0;
var webType="";
var siteImageS3Url = "/Templates/Site61/Dino/images/";
var siteUrl = "/Templates/Site61/Dino/";
var w3c=(document.getElementById)? true: false;
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
function IeTrueBody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function GetScrollTop(){
 return ie ? IeTrueBody().scrollTop : window.pageYOffset;
}
if(window.ActiveXObject)
{
	webType="IE";	
}
else
{
	webType="";	
}

function changeCurrency(str)
{
	SetCookie("_currency",str,24*7);
	var c2 = document.getElementById("Currency2");
	c2.innerHTML = '<iframe src="/Changecurrency.cfm?cur=' + str + '"></iframe>';
}
	
function getOffset(obj) {
    var offset = {offsetLeft: 0, offsetTop: 0};
    while (obj) {
        offset.offsetLeft += obj.offsetLeft;
        offset.offsetTop += obj.offsetTop;
        obj = obj.offsetParent;
    }
    return offset;
}

function showCurrency(num)
{
	var showCur = document.getElementById("currencyshow");
	var pros = document.getElementById("imgshow");
	oRect = getOffset(pros);
	
    if (showCur.parentNode != null) {
	    oRect1 = getOffset(showCur.parentNode);
        oRect.offsetLeft = oRect.offsetLeft - oRect1.offsetLeft;
    }
	xpos = oRect.offsetLeft - 124;
	ypos = oRect.offsetTop + 15;
	showCur.style.left = (xpos+42).toString() +'px';
	showCur.style.top = ypos.toString() +'px';
	showCur.style.zIndex = 1000;
	showCur.className="currencyOptionsSub";
	if(showCur.style.display == "none")
	{
		showCur.style.display = "";
	}
	else
	{
		showCur.style.display = "none";
	}
}

function showLanguageCurrency()
{
	var showCur = document.getElementById("currencyshowLanguage");
	var pros = document.getElementById("imgshowlanguage");
	oRect = getOffset(pros);
	
    if (showCur.parentNode != null) {
	    oRect1 = getOffset(showCur.parentNode);
        oRect.offsetLeft = oRect.offsetLeft - oRect1.offsetLeft;
    }
	xpos = oRect.offsetLeft - 125;
	ypos = oRect.offsetTop + 14;
	showCur.style.left = xpos.toString() +'px';
	showCur.style.top = ypos.toString() +'px';
	showCur.style.zIndex = 1000;
	if(showCur.style.display == "none")
	{
		showCur.style.display = "";
	}
	else
	{
		showCur.style.display = "none";
	}
}


function showCurrency2(num,mtop)
{
	var showCur = document.getElementById("currencyshow2");
	var pros = document.getElementById("imgshow2");
	oRect = getOffset(pros);
	
    if (showCur.parentNode != null) {
	    oRect1 = getOffset(showCur.parentNode);
        oRect.offsetLeft = oRect.offsetLeft - oRect1.offsetLeft;
    }
	xpos = oRect.offsetLeft+110 ;
	if(typeof(mtop)!="undefined"){
		ypos = oRect.offsetTop + mtop;
	}else{
		ypos = oRect.offsetTop + 15;
	}
	showCur.style.left = (xpos-100).toString() +'px';
	showCur.style.top = (ypos-10).toString() +'px';
	showCur.style.zIndex = 1000;
	showCur.style.borderTop="solid 1px #cccccc"; 
	if(showCur.style.display == "none")
	{
		showCur.style.display = "";
	}
	else
	{
		showCur.style.display = "none";
	}
}

function showCurrency3(num)
{
	var showCur = document.getElementById("currencyshow3");
	var pros = document.getElementById("imgshow3");
	oRect = getOffset(pros);
	
    if (showCur.parentNode != null) {
	    oRect1 = getOffset(showCur.parentNode);
    }
	xpos = oRect.offsetLeft;
	ypos = oRect.offsetTop + 30;
	showCur.style.left = xpos.toString() +'px';
	showCur.style.top = ypos.toString() +'px';
	showCur.style.zIndex = 1000;
	if(showCur.style.display == "none")
	{
		showCur.style.display = "";
	}
	else
	{
		showCur.style.display = "none";
	}
}
function showCurrency4()
{
	var showCur = document.getElementById("currencyshow2");
	if(showCur.style.display == "none")
	{
		showCur.style.display = "block";
	}
	else
	{
		showCur.style.display = "none";
	}
}




function showthiscur()
{
	isondiv = 1;
}
function showthiscur2()
{
	isondiv2 = 1;
}
function showthiscur3()
{
	isondiv3 = 1;
}

function changeCurr(str)
{
	var curr = document.getElementById("curr");
	window.location = "/Shoppingcart/?cur=" + str;
}

function closecurdiv()
{
	isondiv = 0;
	setTimeout(closedivwhenmoveout, 250);
}

function closecurdiv2()
{
	isondiv2 = 0;
	setTimeout(closedivwhenmoveout2, 250);
}
function closecurdiv3()
{
	isondiv3 = 0;
	setTimeout(closedivwhenmoveout3, 250);
}

function closedivwhenmoveout()
{
	var showCur = document.getElementById("currencyshow");
	var showCur2 = document.getElementById("currencyshowLanguage");
	var showCur3 = document.getElementById("div_MyAccount");
	if(isondiv == 0){
		showCur.style.display = "none";
		showCur2.style.display = "none";
		showCur3.style.display = "none";
	}
}

function closedivwhenmoveout2()
{
	var showCur = document.getElementById("currencyshow2");
	if(isondiv2 == 0)
		showCur.style.display = "none";
}

function closedivwhenmoveout3()
{
	var showCur = document.getElementById("currencyshow3");
	if(isondiv3 == 0)
		showCur.style.display = "none";
}


function AdAnalyticsRecord(urlparam)
{
	var urlparam=urlparam.replace(new RegExp("-","gi"),"|");
	var AdAnalyticsHTTP = "/task/AdAnalytics.cfm";
	AdAnalyticsHTTP = AdAnalyticsHTTP + "?AdAnalytics="+urlparam;
	var ins=urlparam.split("|");
	if(ins[3]!=1){
		var urlcode = ReadCookie("urlcode");
		var cilckcookiekey="ClickAdAnalytics"+ins[2];
		if(urlcode==""){
			SetCookie("urlcode",new Date().getTime(),24);
			urlcode = ReadCookie("urlcode");
		}
		AdAnalyticsHTTP = AdAnalyticsHTTP + "&urlcode="+urlcode;
		if(ins[3]==2){
			if(ins[0]>0){
				var ckv=ins[0]+"|"+ins[1]+"|"+ins[2]+"|3|"+ins[4];
				SetCookie("AdAnalytics",ckv,24);
			}
			if(ReadCookie(cilckcookiekey)==""){
				SetCookie(cilckcookiekey,ins[2],24);
				document.writeln("<script src=\""+AdAnalyticsHTTP+"\"></script>");
			}
		}else{
			document.writeln("<script src=\""+AdAnalyticsHTTP+"\"></script>");
		}
	}
}

function ShowLeftLongbanner(cf_pics,cf_links,cf_texts)
{
	var focus_width=165; 
	var focus_height=400;
	var text_height=0;
	var swf_height = focus_height+text_height;
	var pics=cf_pics;
	var links=cf_links;
	var texts=cf_texts;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/images/ad.swf"> <param name="quality" value="high"><param name="bgcolor" value="#CCCCCC">');
	
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	
	document.write('<embed src="/images/ad.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');	
}

function affid_getParam(s_affidString){
	affid_id = window.location.href.toLowerCase().split("/");
	iRandom = Math.floor(Math.random()*100+1);
	for(var i = 0; i < affid_id.length; i++) {
		if(affid_id[i].substring(0,s_affidString.length)==s_affidString){
			affid_id = affid_id[i].split("-");
			affid_id = affid_id[1].split(".")[0];
			if(affid_id && isNaN(affid_id)==false){
				SetCookie("AFFILIATELINKID",affid_id,2160)
			}
		}
	}
}
function getUrlArgs() {
    var args = new Object( );
    var query = window.location.search.substring(1);     // Get query string
	query = decodeURIComponent(query.toLowerCase());
	var affid_urlLink_p = decodeURIComponent(window.location.href.toLowerCase());
	if(affid_urlLink_p.indexOf('~p.')>0){
		if(affid_urlLink_p.indexOf('.com/~p.')>0){
		affid_urlLink_p = affid_urlLink_p.replace(".com/~p.",".com/?p=");
		affid_urlLink_p = affid_urlLink_p.replace("~p.","&p=");
		}else{
		affid_urlLink_p = affid_urlLink_p.replace("~p.","?p=");
		}
		query = affid_urlLink_p.substring(affid_urlLink_p.indexOf('?')+1);
		query = query.replace("?","&");
	}
	query = query.replace("~p=","p=");
	if(query.indexOf('=')==-1){query = query + "=1";}
    var pairs = query.split("&");                 // Break at ampersand
    for(var i = 0; i < pairs.length; i++) {
        var pos = pairs[i].indexOf('=');          // Look for "name=value"
        if (pos == -1) continue;                  // If not found, skip
        var argname = pairs[i].substring(0,pos);  // Extract the name
        var value = pairs[i].substring(pos+1);    // Extract the value
        value = decodeURIComponent(value);        // Decode it, if needed
        args[argname] = value;                    // Store as a property
    }
    return args;                                  // Return the object
}
if(getUrlArgs()["adanalytics"]){AdAnalyticsRecord(getUrlArgs()["adanalytics"]);}

function trim(s){return rtrim(ltrim(s));}
function ltrim(s){return s.replace( /^\s*/, "");} 
function rtrim(s){return s.replace( /\s*$/, "");}

function getOffset(obj) {
    var offset = {offsetLeft: 0, offsetTop: 0};
    while (obj) {
        offset.offsetLeft += obj.offsetLeft;
        offset.offsetTop += obj.offsetTop;
        obj = obj.offsetParent;
    }
    return offset;
}

function OpenMyAccount(ShowType)
{
	var MyAccount = document.getElementById("div_MyAccount");
	var pros = document.getElementById("A_MyAccount");
	oRect = getOffset(pros);
	
    if (MyAccount.parentNode != null) {
	    oRect1 = getOffset(MyAccount.parentNode);
        oRect.offsetLeft = oRect.offsetLeft - oRect1.offsetLeft;
    }
	xpos = oRect.offsetLeft - 90;
	ypos = oRect.offsetTop + 16;
	MyAccount.style.left = xpos.toString() +'px';
	MyAccount.style.top = ypos.toString() +'px';
	MyAccount.style.zIndex = 1000;
	if(MyAccount.style.display == "none")
	{
		MyAccount.style.display = "";
	}
	else
	{
		MyAccount.style.display = "none";
	}
}

function CloseMyAccount()
{
	var MyAccount = document.getElementById("div_MyAccount");
	MyAccount.style.display = "none";
}

function ReadCookie(name){      
  var cookieValue='';      
  var search=name+'=';      
  if(document.cookie.length>0){      
    offset=document.cookie.indexOf(search);      
    if (offset!=-1){      
      offset+=search.length;      
      end=document.cookie.indexOf(';', offset);      
      if (end == -1) end=document.cookie.length;      
      cookieValue = unescape(document.cookie.substring(offset,end))      
    }      
  }      
  return cookieValue;      
}      
     
function SetCookie(name,value,hours){ 
  var expire = "";  
  path="/";   
  if(hours != null){      
    expire = new Date((new Date()).getTime() + hours * 3600000);      
    expire = "; expires=" + expire.toGMTString();      
  }  
  if(name.toLowerCase()=="affiliatelinkid"){
	  var affidck = ReadCookie(name);
	  if(affidck>0 && affidck!=value){
		  document.cookie = "AFFILIATELINKNEXTID" + "=" + escape(value) + expire + ((path == null) ? "" : (";domain=dailyshop.com; path=" + path));
	  }else{
		  document.cookie = name + "=" + escape(value) + expire + ((path == null) ? "" : (";domain=dailyshop.com; path=" + path));
		  document.cookie = "AFFILIATELINKNEXTID" + "=" + escape(value) + expire + ((path == null) ? "" : (";domain=dailyshop.com; path=" + path));
	  }
  }else{
	  document.cookie = name + "=" + escape(value) + expire + ((path == null) ? "" : (";domain=dailyshop.com; path=" + path)); 
  }
}

function CheckBottomForm()
{
	var orderId = document.getElementById('bottomSeOrderId').value;
	orderId = trim(orderId.toLowerCase());
	orderIdArray = orderId.split("-");
	var str = 'Invalid Order No.';
	if(orderId == "")
	{
		document.getElementById('BottomErrorMsg').innerHTML = str;
		return false;
	}
	if(orderIdArray.length != 2)
	{
		document.getElementById('BottomErrorMsg').innerHTML = str;
		return false;	
	}
	if(orderIdArray[0] == "")
	{
		document.getElementById('BottomErrorMsg').innerHTML = str;
		return false;
	}
	if(orderIdArray[1].search('dd') == -1 || orderIdArray[1].substring(parseInt(orderIdArray[1].length - 2),parseInt(orderIdArray[1].length)) != 'dd' || orderIdArray[1].length != 2)
	{
		document.getElementById('BottomErrorMsg').innerHTML = str;
		return false;
	}
	document.getElementById('BottomErrorMsg').innerHTML = '';
	return true;
}

/*****************************/
var DealDate = function(sDate,eDate,showobj,showtype){
	this.startDailyDeal=sDate;
	this.endDailyDeal=eDate;
	this.timeobj=showobj;
	this.timetype=showtype;
};
DealDate.prototype.loopDailyDeal = 1;
DealDate.prototype.show_timeDailyDeal = function(){
	var _self = this;
	if (this.endDailyDeal <= this.startDailyDeal) {return;}
	var alltimeDailyDeal = parseInt((this.endDailyDeal - this.startDailyDeal) / 1000) - this.loopDailyDeal;
	if(alltimeDailyDeal < 0){
		alltimeDailyDeal = alltimeDailyDeal + 86400
	}
	var dDailyDeal = parseInt(alltimeDailyDeal / 86400);
	var hDailyDeal = parseInt((alltimeDailyDeal - dDailyDeal*86400) / 3600);
	var h2DailyDeal = parseInt((alltimeDailyDeal) / 3600);
	var mDailyDeal = parseInt((alltimeDailyDeal - dDailyDeal*86400 - hDailyDeal*3600) / 60);
	var sDailyDeal = parseInt(alltimeDailyDeal - dDailyDeal*86400 - hDailyDeal*3600 - mDailyDeal*60);
	this.loopDailyDeal ++;
	if(this.timetype==1){
		this.timeobj.innerHTML = this.format_numberDailyDeal(h2DailyDeal) + "<span class='delimiter'>:</span>" + this.format_numberDailyDeal(mDailyDeal) + "<span class='delimiter'>:</span>" + this.format_numberDailyDeal(sDailyDeal);
	}else if(this.timetype==2){
		this.timeobj[0].innerHTML = this.format_numberDailyDeal(h2DailyDeal);
		this.timeobj[1].innerHTML = this.format_numberDailyDeal(mDailyDeal);
		this.timeobj[2].innerHTML = this.format_numberDailyDeal(sDailyDeal);
	}else if(this.timetype==3){
		this.timeobj[0].innerHTML = dDailyDeal;
		this.timeobj[1].innerHTML = this.format_numberDailyDeal(hDailyDeal);
		this.timeobj[2].innerHTML = this.format_numberDailyDeal(mDailyDeal);
		this.timeobj[3].innerHTML = this.format_numberDailyDeal(sDailyDeal);	
	}
	setTimeout(function(){_self.show_timeDailyDeal();},1000);

};
DealDate.prototype.format_numberDailyDeal = function(n){if (n < 10) {return "0" + n;}else{return n;}};


var Surveycookiekey="Surveycookie";
var Showkey="showPhone";
function OpenOnlineSurvey(){
	window.open('/Online Survey.cfm','_bank','height=220,width=570,top=350,left=350,toolbar=no,menubar=no,scrollbar=no,resizable=no,location=no,status=no');
	SetCookie(Surveycookiekey,1,720);
}
function setShowPhone(){
	SetCookie(Showkey,1,720);
}

if(ReadCookie(Surveycookiekey)!=1 && ReadCookie(Showkey)==1){
	window.onload=function(){
		window.onunload=OpenOnlineSurvey;
	};
}

function addCart(url,pid,cur,kid){
	if(pid==0){
		if(cur==''){
			window.top.location.href = url+"Shoppingcart/";
		}else{
			window.top.location.href = url+"Shoppingcart/"+cur;
		}
	}else{
		try{
			pageTracker._trackEvent('Shopcart', 'Add to Cart', kid, 1);
		}catch(e){}	
		window.top.location.href = url+"Shoppingcart/ProductID-"+pid+cur+".html";
	}
}

function checkLanguage(tid,url){
	var paramurl = url.replace(":","%3A");
	paramurl = paramurl.replace(/[/]/g,"%2F");
	paramurl = paramurl.replace("?","%3F");
	paramurl = paramurl.replace(/[&]/g,"%26");
	var ggstr = "http://translate.google.com/translate";
	// set locale 
	var localeStr = "en";
	var localeStrTemp = "en";
	if(tid==1){
		localeStr = "en";
		//window.top.location.href = url;
	}else if(tid==2){
		localeStr = "de";
		//window.top.location.href = ggstr+"?hl=de&sl=en&tl=de&u="+paramurl;
	}else if(tid==3){
		localeStr = "fr";
		//window.top.location.href = ggstr+"?hl=fr&sl=en&tl=fr&u="+paramurl;
	}else if(tid==4){
		localeStr = "nl";
//		window.top.location.href = ggstr+"?hl=nl&sl=en&tl=nl&u="+paramurl;
	}else if(tid==5){
		localeStr = "ru";
		localeStrTemp = "ru";
//		window.top.location.href = ggstr+"?hl=ru&sl=en&tl=ru&u="+paramurl;
	}else if(tid==6){
		localeStr = "es";
//		window.top.location.href = ggstr+"?hl=es&sl=en&tl=es&u="+paramurl;
	}else if(tid==7){
		localeStr = "it";
//		window.top.location.href = ggstr+"?hl=it&sl=en&tl=it&u="+paramurl;
	}else if(tid==8){
		localeStr = "pt";
		localeStrTemp = "pt";
//		window.top.location.href = ggstr+"?hl=pt&sl=en&tl=pt&u="+paramurl;
	}
	//alert(localeStr);
	SetCookie("CLOCALE",localeStrTemp,24);
	//alert(ReadCookie("CLOCALE"));
	if (tid == 1) {
		window.top.location.href = url;
	} else {
		window.top.location.href = ggstr+"?hl="+localeStr+"&sl=en&tl="+localeStr+"&u="+paramurl;
	}
}

// 购物车切换语言 create by wangwenzhou at 2011-3-14
function checkLanguageForCart(tid,url) {
	var localeStr = "en";
	switch(tid){
		case 2:localeStr = "de";break;
		case 3:localeStr = "fr";break;
		case 4:localeStr = "nl";break;
		case 5:localeStr = "ru";break;
		case 6:localeStr = "es";break;
		case 7:localeStr = "it";break;
		case 8:localeStr = "pt";break;
		case 1:
		default:localeStr = "en";break;
	}
	SetCookie("CLOCALE",localeStr,24);
	//alert(ReadCookie("CLOCALE"));
	window.top.location.href = url;
}

function checkWholesaleAccount(no){
	for(var i=1;i<=6;i++){
		if(document.getElementById("AccountOpen"+i)){
			if(i==no){
				document.getElementById("AccountOpen"+i).className="current";
				document.getElementById("ShowOpen"+i).style.display="";
			}else{
				document.getElementById("AccountOpen"+i).className="click";
				document.getElementById("ShowOpen"+i).style.display="none";
			}
		}
	}
}
if(typeof(iIndexMark)!="undefined"){
	var query = window.location.search.substring(1);
	// query = query.toLowerCase();
	if(query.length > 0){
		document.writeln("<script src=\"/API/CreateCookie.cfm?"+query+"\"></script>");
	}
	if(getUrlArgs()["recached"])
	{
		/* document.writeln("<script src=\"/API/CreateIndexToHTML.cfm?vericode=HJT9872LK23&"+query+"\"></script>"); */
	}else if(getUrlArgs()["cur"]){
		window.location.href='/currency-'+getUrlArgs()["cur"]+'.html';
	}
}
function importStaticfiles(path,type){var s,i;if(type=="js"){s=document.createElement("script");s.type="text/javascript";s.src=path;}document.getElementById("cartCountjsarea").appendChild(s);}

var affid_urlLink = decodeURIComponent(window.location.href.toLowerCase());
if(affid_urlLink.indexOf("affid=")>0){
	affid_id = getUrlArgs()["affid"];
	if(affid_id && isNaN(affid_id)==false){SetCookie("AFFILIATELINKID",affid_id,2160);}
}
if(affid_urlLink.indexOf("s=")>0){
	affid_id = getUrlArgs()["s"];
	if(affid_id && isNaN(affid_id)==false){SetCookie("AFFILIATELINKID",affid_id,2160);}
}
if(affid_urlLink.indexOf("affid-")>0){
	affid_getParam("affid-");
}
if(affid_urlLink.indexOf("s-")>0){
	affid_getParam("s-");
}
if(affid_urlLink.indexOf("~p.")>0 || affid_urlLink.indexOf("~p=")>0){
	affid_id = getUrlArgs()["p"];
	affid_id = parseInt(affid_id,16);
	if(affid_id && isNaN(affid_id)==false){SetCookie("AFFILIATELINKID",affid_id,2160);}
}
if(ReadCookie("WREFROM")=="" && document.referrer != ""){SetCookie("WREFROM",document.referrer,21600);}
// write shoppingcart items number to cookie
var jsCartCount = ReadCookie("CARTCOUNT");
//if(isNaN(jsCartCount)==false){if(jsCartCount<0){jsCartCount=0;}}else{jsCartCount=0;}
if(isNaN(jsCartCount)==true || jsCartCount==''){jsCartCount=-1;}
if(jsCartCount<0){
	document.writeln("<script src=\"http://www.dailyshop.com/CartCountAjax.cfm\"></script>");
}
// when username in cookie
function linkdinopoint(){
	location.href=jsSiteUrl+"MyDinoPoints/?cur="+headstrCurrency;
}
function loadJSuserinfo(cartcount){
	jsCartCount = ReadCookie("CARTCOUNT");
	var UserPoint = ReadCookie("USERPOINT");
	var jsStrUserName = ReadCookie("USERNAME").split(" ")[0];
	if(jsStrUserName && jsStrUserName != ""){
		signUpUrl = "'"+jsSiteUrl+"ActionCom/Logout.cfm?cur="+headstrCurrency+"'";
		loginText= '<span style="float:left;">Welcome!&nbsp;</span><span class="login" style="float:left;">';
		/*if(ReadCookie("IDINORSTATS")==1){
			loginText = loginText + '<img src="http://www.DailyShop.com/Templates/Site61/Dino/images/idinor/ma_ic_db_3_bt_sm1.gif" align="absmiddle">&nbsp;';
		}*/
		loginText = loginText + jsStrUserName;
		/*loginText= loginText+'&nbsp;(&nbsp;<strong class="Dino01">Dino</strong><strong class="Point02">Point</strong> : <a href="'+jsSiteUrl+"MyDinoPoints/?cur="+headstrCurrency+'" style="color:#0000CC;">'+UserPoint+'</a> )';*/
		loginText= loginText+'</span>';
		document.getElementById("logout").innerHTML = '&nbsp;<span style="cursor:pointer; color:#336699;" onclick="location.href='+signUpUrl+'">Logout</span>';
		SetCookie("_dino_s_userID",ReadCookie("USERID"),0.33);
	}else{
		signInUrl = "'"+jsSiteUrl+"UserLogin/?cur="+headstrCurrency;
		signInUrl +="&returnUrl="+encodeURIComponent(window.location.href)+"'";
		signUpUrl = "'"+jsSiteUrl+"Register/?cur="+headstrCurrency+"'";
		loginText = 'Welcome.&nbsp;Please&nbsp;';
		loginText = loginText + '&nbsp;<span style="cursor:pointer; color:#336699;" onclick="location.href='+signUpUrl+'" rel="nofollow" target="_self">Create an account</span></span><span class="fc12black"> or </span><span style="cursor:pointer; color:#336699;" onclick="location.href='+signInUrl+'" rel="nofollow" target="_self">Sign In</span>.';
		document.getElementById("logout").innerHTML = "";
		SetCookie("_dino_s_userID",0);
	}
	if(jsCartCount==""){jsCartCount=0;}
	try {
		var hWelcome = document.getElementById("headWelcome");
		var hCart = document.getElementById("headCart");
		hWelcome.innerHTML = loginText;
	if (jsCartCount<0){jsCartCount=0;}
	if (jsCartCount == 0){hCart.style.color = 'red';}else{hCart.style.color = 'green';}		
	if (jsCartCount > 1){hCart.innerHTML = "<span style='color: #ffffff; text-decoration:none'><strong>" + jsCartCount + "</strong> item</span>";}
	else{hCart.innerHTML = "<span style='color: #ffffff; text-decoration:none'><strong>" + jsCartCount + "</strong> item</span>";}
	} catch(e) {}
}

function listlen(strs,mit){
    var sums = 0; 
	for(i=0;i < strs.length;i++){
    	if(strs.charAt(i) == mit){
        	sums=sums+1;
        }
    }
    return sums;
}

function listtoarray(strs,mit){
	var arr = strs.split(mit);
    return arr;
}

function tofloat(f,dec){
	
	
	 return result=chgMoney(f);
	

	/*result=parseInt(f)+(dec==0?"":".")
    f-=parseInt(f);
    if(f==0){
    	for(j=0;j < dec;j++) result+='0';
    }else{
    if(f < 0.1){
    	for(k=0;k < dec;k++){ f*=10;
		if(k==0){result+='0';}else{
        result+=parseInt(Math.round(f));}}
    }else{toFixed
    	for(k=0;k < dec;k++) f*=10;
        result+=parseInt(Math.round(f));
		
    }
    }*/
    return result;
}

function chgMoney(money){
	money = parseFloat(money);
	var key = money.toString().split('.');
	if(typeof(key[1])=='undefined'){
		return key[0]+'.00';	
	}
	if(key[1].length>=3){
		key[1] = key[1].substring(0,3);	
	}
	var tmp1 = key[1].substring(0,2);
	var tmp2 = key[1].substring(2,3);
	var tmp3 = key[1].substring(0,1);
	if(tmp2>=5){
		if(parseInt(tmp3) == 0){tmp1 = parseInt(Number(tmp1))+1;if(tmp1<=9)tmp1='0'+tmp1;}
		else{tmp1 = parseInt(tmp1)+1;}
	}
	if(tmp1>99){
		key[0] = parseInt(key[0]) + 1;
		tmp1 = '00';
	}
	if(tmp1.length == 1){tmp1=tmp1+'0';}
	return key[0].toString() + '.' + tmp1.toString();
}

function tofloatjpy(f){
	if(f==""){
		result=0;
	}else{
		f=Number(f);
		result=f.toFixed(0);
	}
	result1=parseInt(result/10)*10;
	result2=result-result1;
    if(result2 <5){
		result=result1;
	}else{
		result=result1+10;
	}
  //  f1=Math.round(f/10)*10;
//    if((f-f1) < 5){
//    	result=f1;
//    }else{
//    	result=f1+10;
//    }
    return result;
}

function tofloatidr(f){
	if(f==""){
		result=0;
	}else{
		f=Number(f);
		result=f.toFixed(0);
	}

	result1=parseInt(f);
	result2=result-result1;
    if(result2 > 0){
		result=result1+1;
	}else{
		result=result1;
	}
    return result;
}

function GetHtml(imagehref,imagesrc,imagetitle,namehref,nametitle,nameshow,priceshow,priceshow1){
	var TempHtml="<div class='historytext'><div class='historytext_lft'>"+"<a target='_blank' href= '" + imagehref +  "'><img border='0' src='"+imagesrc+"' title='"+imagetitle+"'  onerror='ImageOnError(this);' /></a>"+"</div><div class='historytext_rht' id='productshow'><ul><li>"+"<a class='viewedPListA' href='"+namehref+"' title='"+nametitle +"'>"+nameshow+"</a></li>";
	if(priceshow == priceshow1){
		TempHtml= TempHtml+"<li class='oprice'></li><li class='nprice' id='"+priceshow1+"'><span>"+priceshow1+"</span></li></ul></div></div>";
	}else{
		TempHtml= TempHtml+"<li class='oprice' id='"+priceshow+"'>"+priceshow+"</li><li class='nprice' id='"+priceshow1+"'><span>"+priceshow1+"</span></li></ul></div></div>";
	}
    return TempHtml;
}
function productview(site_Image_Path,URLCurrency,curcurrency,DollarName,Symbol,curcur){
	var Delimiter = "@" ;
	if(ReadCookie("IV_ID") && ReadCookie("IV_PT")   && ReadCookie("IV_NAME") && ReadCookie("IV_PR") && ReadCookie("IV_FNAME") && ReadCookie("IV_CUR") 
		&& listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_CUR"), Delimiter) 
		&&	listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_FNAME"), Delimiter) 
		&&	listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_PR"), Delimiter)
		&&	listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_NAME"), Delimiter)
		&&	listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_PT"), Delimiter)
		&&	listlen(ReadCookie("IV_ID"), Delimiter) == listlen(ReadCookie("IV_OPR"), Delimiter))
		{var Array_ProductID = listtoarray(ReadCookie("IV_ID"), Delimiter);
		 var Array_ProductName = listtoarray(ReadCookie("IV_NAME"), Delimiter);
		 var Array_FileName = listtoarray(ReadCookie("IV_FNAME"), Delimiter);
		 var Array_SmallPhoto = listtoarray(ReadCookie("IV_PT"), Delimiter);
		 var Array_Currency = listtoarray(ReadCookie("IV_CUR"), Delimiter);
		 var Array_Price = listtoarray(ReadCookie("IV_PR"), Delimiter);
		 var Array_oldPrice = listtoarray(ReadCookie("IV_OPR"), Delimiter);
		 var ShowTheList = true;
	}else{
		 var ShowTheList = false;
		 document.getElementById("lastbottomcss").style.display="none";
	}
	var viewString = "";
	if(ShowTheList){
			for(i=0;i < Array_ProductID.length;i++){
				 imagehref_value = "/"+Array_FileName[i]+URLCurrency+".html";
				 imagesrc_value = site_Image_Path+Array_SmallPhoto[i].replace('small.jpg','icon.jpg');
				 imagetitle_value = Array_ProductName[i];
				 namehref_value = "/"+Array_FileName[i]+URLCurrency+".html";
				 nametitle_value = Array_ProductName[i];
				if (Array_ProductName[i].length > 18){
					 nameshow_value = Array_ProductName[i].substring(0,18)+"...";
				}else{
					 nameshow_value = Array_ProductName[i];
				}
				if(curcurrency == 'JPY'){
					
						priceshow_value = getCurShow(curcurrency,DollarName+Symbol,tofloatjpy(Array_oldPrice[i]*curcur));
						priceshow_value1 = getCurShow(curcurrency,DollarName+Symbol,tofloatjpy(Array_Price[i]*curcur));

				}else if(curcurrency == 'IDR' || curcurrency == 'RUB'){
					
						priceshow_value = getCurShow(curcurrency,DollarName+Symbol,tofloatidr(Array_oldPrice[i]*curcur));
						priceshow_value1 = getCurShow(curcurrency,DollarName+Symbol,tofloatidr(Array_Price[i]*curcur));
		
				}else{  
					
						priceshow_value = getCurShow(curcurrency,DollarName+Symbol,tofloat(Array_oldPrice[i]*curcur,2));
						priceshow_value1 = getCurShow(curcurrency,DollarName+Symbol,tofloat(Array_Price[i]*curcur,2));
			
				 }
				 viewString = viewString + GetHtml(imagehref_value,imagesrc_value,imagetitle_value,namehref_value,nametitle_value,nameshow_value,priceshow_value,priceshow_value1); 	
			}
					viewString = "<div class='historytitle'>Your Recent History</div>"+viewString;
		}
	var htmlstring = viewString;
	GetProductIview(htmlstring);
}
function GetProductIview(htmlstring)
{
	try {
            if(document.getElementById("divLastIviewed"))
            {
            	document.getElementById("divLastIviewed").innerHTML = htmlstring;
            }   
        } catch(e) {}
}
var isMoveOutCust = 0;

function MoveOutCustom(){
	isMoveOutCust = 1;
	setTimeout(closeCustomerhelp,250);
}
function MoveOverCustom(){
	isMoveOutCust = 0;
}
function showCustomerhelp(){
	editMarkClass(1);
	document.getElementById("Customerhelp").className = "fc36c";
	document.getElementById("Customerhelpshow").style.display = "block";
	isMoveOutCust = 0;
}

function closeCustomerhelp(){
	if(isMoveOutCust==1){
		editMarkClass(0);
		document.getElementById("Customerhelp").className = "fc36c";
		document.getElementById("Customerhelpshow").style.display = "none";
	}
}

// when load product images error
function ImageOnError(obj, type, url) {
	if (obj.src.indexOf('gemsimage.lefux.com') == -1 && obj.src.indexOf('p.lefux.com') > 0) {
		obj.src=obj.src.replace('http://Gemini.18985.com/hosting/167/Activity/', 'shipimage.lefux.com/hosting/167/');
	}else if(obj.src.indexOf('shipimage.lefux.com') == -1 && obj.src.indexOf('hosting.dailyshop.com') > 0){
		obj.src=obj.src.replace('http://hosting.dailyshop.com/167/', 'http://shipimage.lefux.com/hosting/167/');
	}
	//if (obj.src.indexOf('gemsimage.lefux.com') == -1 && obj.src.indexOf('hosting.DailyShop.com') > 0) {obj.src=obj.src.replace('hosting.DailyShop.com', 'gemsimage.lefux.com');}
}
function ImageOnError2(obj, type, url) {if (obj.src.indexOf('gems.lefux.com') == -1 && obj.src.indexOf('hosting.DailyShop.com') > 0) {obj.src=obj.src.replace('hosting.DailyShop.com', 'gems.lefux.com');}}var ArrayImageError = [];function WriteImageError(){}function CreateLogFile(){} 
// more ways to shop switch
function moreshop(divcount, divid,m){for(var i = divcount ; i > 0; i --){var getdiv = document.getElementById(i);getdiv.style.display = 'none';if(i!=m){
document.getElementById('shopwayspic_'+i).innerHTML='<img src="/Templates/Site61/Dino/images/morewayarrow.gif" />';/*document.getElementById('ShopWays_'+i).className='select';document.getElementById('ShopWaysName_'+i).className='mv_title';*/}else{
document.getElementById('shopwayspic_'+i).innerHTML='<img src="/Templates/Site61/Dino/images/morewayarrow2.gif" />';/*document.getElementById('ShopWays_'+m).className='selectedStyle';document.getElementById('ShopWaysName_'+m).className='mv_titleSelect';*/}}var getdivshow = document.getElementById(divid);getdivshow.style.display = '';}

function addCurrency(strLink){
    if(typeof(headstrCurrency) =="string" && headstrCurrency.toLowerCase() != "usd"){
        if(strLink.indexOf("www.DailyShop.com",0) >= 0){
            if(strLink.indexOf("?",0) > 0){
                strLink = strLink + "&cur="+headstrCurrency;
            }else{
                strLink = strLink + "?cur="+headstrCurrency;
            }
        }
    }
	window.location.href = strLink;
}

function getIdinorprice(tempProductID,tempProductPrice,disCountProductPrice,Discount_int,showtype,curcurrency,DollarName,Symbol,IsDiscountLoss5,IsDiscount,oriDisPrice,ThPrice){
	if(curcurrency == 'JPY' || curcurrency == 'IDR' || curcurrency == 'RUB'){
		priceshow_value = getCurShow(curcurrency,DollarName+Symbol,tempProductPrice);
		if(IsDiscount==1 && Discount_int>0){
			Discountpriceshow_value = getCurShow(curcurrency,DollarName+Symbol,oriDisPrice);
		}else{
			Discountpriceshow_value=priceshow_value;
		}
	}else{        
		priceshow_value = getCurShow(curcurrency,DollarName+Symbol,tofloat(tempProductPrice,2));
		if(IsDiscount==1 && Discount_int>0){
			Discountpriceshow_value = getCurShow(curcurrency,DollarName+Symbol,oriDisPrice);
		}else{
			Discountpriceshow_value=priceshow_value;
		}
	}
	// if the product allow discount
		Grid = "";
		Grid += '<span class="fcdfp">'+Discountpriceshow_value+'</span>';
		document.getElementById(tempProductID).innerHTML=Grid;
}


function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function toShowForm()
{
	var height = document.documentElement.scrollHeight;
	var width = document.body.scrollWidth;
	if(ReadCookie("ISF")!=1){
		if(document.getElementById("iframeTopHide")!=null)
		{
			SetCookie("ISF",1,12);
			document.body.style.overflow="hidden";
			if(document.getElementById("iframeTopHide").className == "iframeTopHide")
			{
				document.getElementById("iframeTopHide").height= "9999px";
				document.getElementById("iframeTopHide").width = "1440px";
			}
			else 
			{
				document.getElementById("iframeTopHide").style.height= "9999px";
				document.getElementById("iframeTopHide").style.width ="1440px";
			}
			document.getElementById("iframeTopHide").style.display="";
		}
		if(document.getElementById("divShow")!=null)
		{
			if(webType=="IE")
			{
				document.getElementById("divShow").style.top = GetScrollTop()+240;
			}
			else
			{
				document.getElementById("divShow").style.top =	(GetScrollTop()+240)+"px";
			}
			document.getElementById("divShow").style.left = "350px";
			document.getElementById("divShow").style.display="";	
		}
	}
}
function doClose()
{
	document.body.style.overflow="";
	if(document.getElementById("iframeTopHide")!=null)
	{
		document.getElementById("iframeTopHide").style.display="none";	
	}
	if(document.getElementById("divShow")!=null)
	{
		document.getElementById("divShow").style.display="none";	
	}
}

function facebooklanding(urlpath,banner,num){
	xmlHttp=GetXmlHttpObject();
	isopen=urlpath;
	if(xmlHttp==null){
		return;
	}
	affid = 0;
	if(ReadCookie("AFFILIATELINKID") != "" && ReadCookie("AFFILIATELINKID") != 0){
		urlpath=urlpath+'?FBffid='+ReadCookie("AFFILIATELINKID");
		affid = ReadCookie("AFFILIATELINKID");
	}
	if(urlpath == ""){
		urlpath=1	
	}
	var url="/facebooklanding";
	url=url+"?urlpath="+urlpath+"&banner="+banner+"&affid="+affid+"&num="+num;
	url=url+"&sid="+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	if(num == 3){
	ComDlg.dlg.hide('facebookdlg');	
	}
	if(isopen != 1){
		window.open(urlpath);
	}
	if(num == 11 || num == 12 || num ==13 || num == 14){return true;}
	return false;
}
function toTrunc()
{
	window.location.href="http://www.DailyShop.com/html/idinor.cfm#idinor";
}
var isSubfb = 0;
function subfb(){
	if(isSubfb==0){
		isSubfb=1;
		var rdos = document.getElementById("RatingIds").value;
		var formparam = "RatingIds="+rdos;
		var rdosary = rdos.toString().split("@");
		var url="/ActionCom/feedback.cfm";
		var errormsg = document.getElementById("error_msg");
		for(var i=0;i<rdosary.length;i++){
			var b=0;
			for(var j=1;j<6;j++){
				if(document.getElementById('radio'+j+'_'+rdosary[i]).checked){
					formparam = formparam + '&radio' + rdosary[i] + '=' + j;
					b=1;
				}
			}
			if(b==0){
				errormsg.style.display = '';
				isSubfb=0;
				return false;
			}
		}
		errormsg.style.display = 'none';
		if(document.getElementById("ComSel").value!=''){
			formparam = formparam + '&ComSel=' + document.getElementById("ComSel").value;
			if(trim(document.getElementById("ComTxt").value)!=""){
				if(trim(document.getElementById("ComTxt").value)=="Please enter your comments based on the topic you selected above."){	
				}else{
					formparam = formparam + '&ComTxt=' + trim(document.getElementById("ComTxt").value);
				}
				
			}
		}
		formparam = formparam + '&link=' + window.location.href;
		url = url + "?" + formparam;
		
		var xmlHttp = null; 
		try 
		{ 
		  // Firefox, Opera 8.0+, Safari 
		  xmlHttp=new XMLHttpRequest(); 
		} 
		catch (e) 
		{ 
			try 
		   { 
			// Internet Explorer 
			xmlHttp=new ActiveXObject('Msxml2.XMLHTTP'); 
		   } 
		   catch (e) 
		   { 
				try 
				{ 
				 xmlHttp=new ActiveXObject('Microsoft.XMLHTTP'); 
				} 
				catch (e) 
				{ 
					isSubfb=0;
					return false; 
				} 
		   } 
		} 
	  xmlHttp.onreadystatechange=function() 
	  { 
	   if(xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	   { 
	    isSubfb=0;
		iDinorComDlg.dlg.hide('DD_pfbox');
		iDinorComDlg.dlg.show('DD_pfbox2');
		for(var i=0;i<rdosary.length;i++){
			for(var j=1;j<6;j++){
				document.getElementById('radio'+j+'_'+rdosary[i]).checked=false;
			}
		}
	   } 
	  } 
	  xmlHttp.open('POST',url,true); 
	  xmlHttp.send(null); 
	}
}

function ComTxtBlur(){
	if(trim(document.getElementById("ComTxt").value)==""){
		document.getElementById("ComTxt").value="Please enter your comments based on the topic you selected above.";
		document.getElementById("ComTxt").style.color="#CCCCCC";
	}
}

function ComTxtFocus(){
	if(trim(document.getElementById("ComTxt").value)=="Please enter your comments based on the topic you selected above."){
		document.getElementById("ComTxt").value="";
		document.getElementById("ComTxt").style.color="";
	}
}

function brandShowChg(nowPage,allPage){
	document.getElementById('brandFastGo').innerHTML = '';
	for(i=1;i<=allPage;i++){
		if(i==nowPage){
			document.getElementById('brandFastGo').innerHTML += '<img src="/templates/site61/dino/images/brand/dailydeal_imt1.gif" width="11" height="11" />';
		}else{
			document.getElementById('brandFastGo').innerHTML += '<a href="javascript:brandShowChg('+i+','+allPage+')"><img src="/templates/site61/dino/images/brand/dailydeal_imt2.gif" width="11" height="11" /></a>';
		}
		document.getElementById('brandIndexPage_'+i).style.display = 'none';	
	}
	document.getElementById('brandIndexPage_'+nowPage).style.display = '';
	if(nowPage>1){
		document.getElementById('brandLeftGo').innerHTML = '<a href="javascript:brandShowChg('+(parseInt(nowPage)-1)+','+allPage+')"><img src="/templates/site61/dino/images/brand/dailydeal_imL.gif" width="17" height="61" /></a>';	
	}else{
		document.getElementById('brandLeftGo').innerHTML = '<a href="javascript:brandShowChg('+allPage+','+allPage+')"><img src="/templates/site61/dino/images/brand/dailydeal_imL.gif" width="17" height="61" /></a>';
	}
	if(nowPage<allPage){
		document.getElementById('brandRightGo').innerHTML = '<a href="javascript:brandShowChg('+(parseInt(nowPage)+1)+','+allPage+')"><img src="/templates/site61/dino/images/brand/dailydeal_imR.gif" width="17" height="61" /></a>';	
	}else{
		document.getElementById('brandRightGo').innerHTML = '<a href="javascript:brandShowChg(1,'+allPage+')"><img src="/templates/site61/dino/images/brand/dailydeal_imR.gif" width="17" height="61" /></a>';	
	}
	var func2 = null;
	if(nowPage==allPage){
		func2 = 'brandShowChg(1,'+allPage+')';
	}else{
		func2 = 'brandShowChg('+(parseInt(nowPage)+1)+','+allPage+')';	
	}
	window.clearTimeout(timeOutId);
	timeOutId = window.setTimeout(func2,5000);
}

function getCurrentTimeForFree(){
	document.getElementById('saveFreetrial').src = "/actioncom/freetrialaction.cfm";
	var d = new Date(dailyDealCurrentTime);
	var tmpDate = d.getDate();
	d.setDate(parseInt(tmpDate)+30);
	var myYear = (d.getYear()<1900)?(1900+d.getYear()):d.getYear();
	var targetTime = myYear + '/' + (d.getMonth()+1) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	var sDate = new Date(dailyDealCurrentTime).getTime();
	var eDate = new Date(targetTime).getTime();
	var timeobj = new Array(4);
	timeobj[0]=document.getElementById("Div_DailyDealTimer_D1");
	timeobj[1]=document.getElementById("Div_DailyDealTimer_H1");
	timeobj[2]=document.getElementById("Div_DailyDealTimer_M1");
	timeobj[3]=document.getElementById("Div_DailyDealTimer_S1");
	var dealdateobj1 = new DealDate(sDate,eDate,timeobj,3);
	dealdateobj1.show_timeDailyDeal();
}

function fixPng(){
	var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    } 
} 

function imgCenter(tObj,cc,nc){
	try{
		tObj.style.marginTop = "0px";
		var pObj = tObj.parentNode; 
		if(cc>1){ 
			for(var i=1;i<cc;i++){ 
				pObj = pObj.parentNode;
				if(cc-nc-1==i){
					var pnObj = pObj;
				}
			} 
		} 
		if(!pnObj){
			pObj.style.textAlign="center";
		}
		pHeight = pObj.style.height;
		pWidth = pObj.style.width;
		if(pHeight.length <= 2){
			pHeight = getEyeJsStyle(pObj,"height");
		}
		if(pHeight.length > 2){
			pHeight = parseInt(pHeight.substring(0,pHeight.length-2)); 
		}
		if(pWidth.length <= 2){
			pWidth = getEyeJsStyle(pObj,"width");
		}
		if(pWidth.length > 2){
			pWidth = parseInt(pWidth.substring(0,pWidth.length-2)); 
		}
		tHeight = tObj.height; 
		tWidth = tObj.width; 
		if(pHeight>tHeight){
			var margtop = parseInt((pHeight-tHeight)/2); 
			if(margtop>0){
				if(pnObj){
					pnObj.style.paddingTop = margtop+"px"; 
					pnObj.style.height = (pHeight-margtop)+"px"; 
					if(pWidth>tWidth){
						var margleft = parseInt((pWidth-tWidth)/2);
						pnObj.style.paddingLeft = margleft+"px"; 
						pnObj.style.width = (tWidth+2)+"px";
					}
				}else{
					tObj.style.marginTop = margtop+"px"; 
				}
			}
		}
	}catch(e){}
} 

function getEyeJsStyle(obj,styleName){ 
	var $=function(id){return document.getElementById(id) }; 
	if(obj.currentStyle){//ie 
		return obj.currentStyle[styleName]; 
	}else{ //ff 
		var $arr=obj.ownerDocument.defaultView.getComputedStyle(obj, null); 
		return $arr[styleName]; 
	} 
} 

function getCurShow(cur,curSymbol,p,sType){
	var returnStr="";
	var rePrice=p;
	if(cur=="BRL" || cur=="brl"){
		var strp = p.toString();
		var pary = strp.split(".");
		var rePrice2 = pary[0];
		var rePrice3 = "";
		if(rePrice2.length>3){
			for(var i=1;i*3<rePrice2.length;i++){
				rePrice3 = "."+rePrice2.substring(rePrice2.length-i*3,rePrice2.length-(i-1)*3)+rePrice3;
			}
			rePrice3 = rePrice2.substring(0,rePrice2.length-(i-1)*3)+rePrice3;
		}else{
			rePrice3 = rePrice2;
		}
		if(pary[1]){
			var rePrice = pary[1];
		}else{
			var rePrice = '00';
		}
		rePrice = rePrice3 + "," + rePrice;
	}else if(cur=="RUB" || cur=="rub"){
		var strp = p.toString();
		var rePrice2 = "";
		if(strp.length>3){
			for(var i=1;i*3<strp.length;i++){
				rePrice2 = " "+strp.substring(strp.length-i*3,strp.length-(i-1)*3)+rePrice2;
			}
			rePrice = strp.substring(0,strp.length-(i-1)*3)+rePrice2;
		}
	}
	if(sType==1){
		returnStr = rePrice;
	}else{
		if(cur=="RUB" || cur=="rub"){
			returnStr = rePrice+" "+curSymbol;
		}else{
			returnStr = curSymbol+" "+rePrice;
		}
	}
	return returnStr;
}

function idinorEnter(httpUrl,TypeCurrency){
var jsStrUserName = ReadCookie("USERNAME").split(" ")[0];
	if(jsStrUserName && jsStrUserName != ""){
		if(ReadCookie("IDINORSTATS")==1){
			enterText = "<a  target='_blank' href='"+httpUrl+"livehelp/qtype-8/"+TypeCurrency+"'>Start one-to-one Livechat</a>";
		}else{
			if(TypeCurrency == ""){TypeCurrency=".html";}
			else{TypeCurrency = "-"+TypeCurrency;}
			enterText = "<a href='"+httpUrl+"html/idinor"+TypeCurrency+"'>How to be iDinor member</a>";
		}
	}else{
			enterText = "<a  target='_blank' href='"+httpUrl+"livehelp/qtype-8/"+TypeCurrency+"'>Start one-to-one Livechat</a>";
	}
	var ime = document.getElementById("iDinorMemberEnter");
	ime.innerHTML = enterText;
}

var newprocount = 1;
function TurnNewR(nums){
	
	if(newprocount >= nums-5 || nums <= 6){
		return false;
	}
	newprocount = newprocount+1;
	for(i=1;i<=nums;i++){
		document.getElementById("newpro"+i).style.display="none";
	}
	for(i=newprocount;i<=newprocount+5;i++){
		document.getElementById("newpro"+i).style.display="";
	}
	return false;
}

function TurnNewL(nums){
	if(newprocount <= 1 || nums <= 6){
		return false;
	}
	newprocount = newprocount-1;
	for(i=1;i<=nums;i++){
		document.getElementById("newpro"+i).style.display="none";
	}
	for(i=newprocount;i<=newprocount+5;i++){
		document.getElementById("newpro"+i).style.display="";
	}
	return false;
}

window.onbeforeunload = function()
{
	SetCookie("CARTCOUNT",-1,24*7);
};

function isEmail(s){
	s = trim(s); 
 	var p = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/i; 
 	return p.test(s);
}

function SpecOrderOnSubmit() {
	var m=0;
	var obj = document.getElementById('soemail');
	var type = document.getElementsByName('ProductType');
	if (!isEmail(obj.value)) {
		alert("Please enter an email address of you!");
		obj.focus();
		obj.select();
		return false;
	}
	if(type.length > 0){
		for(var i=0;i<type.length;i++){
			if(type[i].checked)m++;	
		}
		if(m == 0){
			alert("You have to select at least one option to continue the subscription!");
			obj.focus();
			obj.select();
			return false;	
		}
	}
	return true;
}
