﻿function selectvisit(visitid,urldown){
		document.getElementById(visitid).style.background="url("+urldown+") left center no-repeat";
}
function changeUrl()
{
	var PageSize=document.getElementById('PageSize').value;
	var Sortby=document.getElementById('Sortby').value;
	var sUrl = "/shopways/New-Arrivals";
	if (PageSize == 15){
		sUrl ="/shopways/New-Arrivals"+ "-pagesize-15";
	    sUrl ="/shopways/New-Arrivals"+ "-sortby-"+String(Sortby);
	   } else{
		   window.location = ""/shopways/New-Arrivals-page-"+pnicurpage+urlcurrency.html";
	
	   }
}

function changePageSize(PageUrl,PageName,PageSize, PageID,showType,TimeParams,subse,listse,minprice,discount,maxprice,videos,subkeywords,curParams)
{
	var Sortby = document.getElementById('Sortby').value;
	var sUrl = PageUrl;
	if(PageName != "")
	{
		sUrl += "/"+PageName +"-"+ PageSize + Sortby + PageID + showType ;
	}
	else
	{
		sUrl += "-"+PageSize + Sortby + PageID + showType ;
	}
	if(TimeParams != "")
	{
		sUrl += TimeParams+"/" ;
	}
	else
	{
		sUrl += "/";
	}
	var subSe = subse;
	var ListSe = listse;
	var MinPrice = minprice;
	var Discount = discount;
	var MaxPrice = maxprice;
	var Videos = videos;
	var SubKeyword = subkeywords;
	if(subSe  == "yes" || ListSe == "yes"){
		if(subSe  == "yes" ){
			sUrl += "subse-"+subSe;
		}
		if(SubKeyword != ""){
				sUrl += "-SubKeyword-"+SubKeyword;
		}
		if(MinPrice != ""){
				sUrl += "-MinPrice-"+MinPrice;
		}
		if(MaxPrice != ""){
				sUrl += "-MaxPrice-"+MaxPrice;
		}
		if(Discount != ""){
				sUrl += "-Discount-"+Discount;
		}
		if(Videos != ""){
				sUrl += "-Videos-"+Videos;
		}
		sUrl = sUrl + "/";
	}
	//sUrl += "-showType-"+showType;
	//sUrl += "-pagesize-"+PageSize;
	//sUrl += "-sortby-"+String(Sortby);
	if(curParams != "")
		window.location = sUrl + curParams;
    else
		window.location = sUrl;
}

function changeSortby(PageUrl,PageName,Sortby, PageID,showType,TimeParams,subse,listse,minprice,discount,maxprice,videos,subkeywords,curParams)
{	
	var PageSize = document.getElementById('PageSize').value;
	var sUrl = PageUrl;
	if(PageName != "")
	{
		sUrl += "/"+PageName +"-"+ PageSize + Sortby + PageID + showType ;
	}
	else
	{
		sUrl += "-"+PageSize + Sortby + PageID + showType ;
	}
	if(TimeParams != "")
	{
		sUrl += TimeParams+"/" ;
	}
	else
	{
		sUrl += "/";
	}
	var subSe = subse;
	var ListSe = listse;
	var MinPrice = minprice;
	var Discount = discount;
	var MaxPrice = maxprice;
	var Videos = videos;
	var SubKeyword = subkeywords;
	if(subSe  == "yes" || ListSe == "yes"){
		if(subSe  == "yes" ){
			sUrl += "subse-"+subSe;
		}
		if(SubKeyword != ""){
				sUrl += "-SubKeyword-"+SubKeyword;
		}
		if(MinPrice != ""){
				sUrl += "-MinPrice-"+MinPrice;
		}
		if(MaxPrice != ""){
				sUrl += "-MaxPrice-"+MaxPrice;
		}
		if(Discount != ""){
				sUrl += "-Discount-"+Discount;
		}
		if(Videos != ""){
				sUrl += "-Videos-"+Videos;
		}
		sUrl = sUrl + "/";
	}
	//sUrl += "-showType-"+showType;
	//sUrl += "-pagesize-"+PageSize;
	//sUrl += "-sortby-"+String(Sortby);
	if(curParams != "")
		window.location = sUrl + curParams;
    else
		window.location = sUrl;
}
function showCalendar(obj,params,typeParams,curParams,currentdatetime,nextdatetime) {
	var config = {srcObj : obj};
	config.date = Date.Parse(obj, "yyyy-mm-dd");
	config.params = params;
	config.typeParams = typeParams;
	config.curParams = curParams;
	config.currentdatetime = currentdatetime;
	config.nextdatetime = nextdatetime;
	DTP.show(config);
}

function addColor(obj)
{
	document.getElementById(obj).className="this_date1";
}

function delColor(obj)
{
	document.getElementById(obj).className="";
}

function setCssAttribute(obj)
{
	var dateElement = document.getElementById(obj);
	dateElement.onmouseover = function(){overChangeClass(obj);}
	dateElement.onmouseout = function(){outChangeClass(obj);}
	
	//document.getElementById(obj).setAttribute('onmouseover' , 'this.className="left cmonth dayvalue cday2"');
	//document.getElementById(obj).setAttribute('onmouseout' , 'this.className="left cmonth dayvalue cday"');
	
	
}
function overChangeClass(obj){
	document.getElementById(obj).className = "this_date2";
}
function outChangeClass(obj){
	document.getElementById(obj).className = "this_date1";
}

function addBorderCss(obj)
{
	document.getElementById(obj).className="this_date2";
}

function goPage(id)
{
	var PageSize = document.getElementById('PageSize').value;
	var Sortby	= document.getElementById('Sortby').value;
	window.location = "/shopways/New-Arrivals-'+pagename+'-"+PageSize+Sortby+id+"urlcurrency.html";
}

function checkTag()
{
	var subkeyword = $(SubKeyword).value;
	var minp = $(MinPrice).value;
	var maxp = $(MaxPrice).value;
	var pn = /^(-|\+)?\d+(\.\d+)?$/;
	if(trim(minp) == "" && trim(maxp) != ""){
		if(!pn.test(maxp)){						
			$(MaxPrice).value = "";
			$(MaxPrice).focus();
			return false;
		}else if(trim(maxp) < 0){												
			$(MaxPrice).value = "";
			$(MaxPrice).focus();
			return false;
		}
	}else if(trim(minp) != "" && trim(maxp) == ""){
		if(!pn.test(minp)){
			$(MinPrice).value = "";
			$(MinPrice).focus();
			return false;
		}
	}else if(trim(minp) != "" && trim(maxp) != ""){
		if(!pn.test(minp)){						
			$(MinPrice).value = "";
			$(MinPrice).focus();
			if(!pn.test(maxp)){						
				$(MaxPrice).value = "";
				$(MinPrice).focus();
				return false;
			}
			return false;
		}else if(trim(minp) < 0){
			if(!pn.test(maxp)){						
				$(MaxPrice).value = "";
				$(MaxPrice).focus();
				return false;
			}else if(trim(maxp) < 0){												
				$(MaxPrice).value = "";
				$(MaxPrice).focus();
				return false;
			}
		}
		if(!pn.test(maxp)){						
			$(MaxPrice).value = "";
			$(MaxPrice).focus();
			return false;
		}else if(trim(maxp) < 0){												
			$(MaxPrice).value = "";
			$(MaxPrice).focus();
			return false;
		}
	}
	if(minp != "" || maxp != "" || trim(subkeyword) != "" || $(videos).checked || $(discount).checked){
		return true;
	}else{
		return false;	
	}	
}

function checkTag1()
{	
	var minp = document.getElementById("MinPrice").value;
	var maxp = document.getElementById("MaxPrice").value
	var pn = /^(-|\+)?\d+(\.\d+)?$/;
	if(trim(minp) == "" && trim(maxp) != ""){
		if(!pn.test(maxp)){						
			document.getElementById("MaxPrice").value = "";
			document.getElementById("MaxPrice").focus();
			return false;
		}else if(trim(maxp) < 0){												
			document.getElementById("MaxPrice").value = "";
			document.getElementById("MaxPrice").focus();
			return false;
		}
	}else if(trim(minp) != "" && trim(maxp) == ""){
		if(!pn.test(minp)){
			document.getElementById("MinPrice").value = "";
			document.getElementById("MinPrice").focus();
			return false;
		}
	}else if(trim(minp) != "" && trim(maxp) != ""){
		if(!pn.test(minp)){						
			document.getElementById("MinPrice").value = "";
			document.getElementById("MinPrice").focus();
			if(!pn.test(maxp)){						
				document.getElementById("MaxPrice").value = "";
				document.getElementById("MinPrice").focus();
				return false;
			}
			return false;
		}else if(trim(minp) < 0){
			if(!pn.test(maxp)){						
				document.getElementById("MaxPrice").value = "";
				document.getElementById("MaxPrice").focus();
				return false;
			}else if(trim(maxp) < 0){												
				document.getElementById("MaxPrice").value = "";
				document.getElementById("MaxPrice").focus();
				return false;
			}
		}
		if(!pn.test(maxp)){						
			document.getElementById("MaxPrice").value = "";
			document.getElementById("MaxPrice").focus();
			return false;
		}else if(trim(maxp) < 0){												
			document.getElementById("MaxPrice").value = "";
			document.getElementById("MaxPrice").focus();
			return false;
		}
	}
	if(minp != "" || maxp != "" || $(discount).checked){
		return true;
	}else{
		return false;	
	}	
}

function ClearShow(strR,val,topurl,cate){
	if(val != ""){
		if(topurl != "" && cate == "shopfor"){
			var ff=strR.replace('/'+val,'');
			ff=ff+topurl+'/';
			window.location.href="http://www.dinodirect.com"+ff;
		}else{
			var ff=strR.replace('/'+val,'');
			window.location.href="http://www.dinodirect.com"+ff;
		}
	}
}

function chooseRpTitle(rp,ct){
	var scrollid =rp;
	if(document.getElementById(scrollid) != null){
		document.getElementById("idContent").style.display = "none";
		document.getElementById(scrollid).style.display = "block";
		document.getElementById("idContent").id=document.getElementById("idContent").title;
		document.getElementById(scrollid).id="idContent";
		for(i=1;i<=8;i++){
			if(document.getElementById("recent_"+i)!=null){
				document.getElementById("recent_"+i).className = '';
				document.getElementById('recentL_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_01.gif) no-repeat';	
				document.getElementById('recentM_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_02.gif)';	
				document.getElementById('recentR_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_03.gif) no-repeat';
			}
		}
		document.getElementById("recent_"+ct).className = 'this';
	 	document.getElementById('recentL_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_01.gif) no-repeat';	
		document.getElementById('recentM_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_02.gif)';	
		document.getElementById('recentR_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_03.gif) no-repeat';
	}else{
		for(i=1;i<=8;i++){
			if(document.getElementById("recent_"+i)!=null){
				document.getElementById("recent_"+i).className = '';
				document.getElementById('recentL_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_01.gif) no-repeat';	
				document.getElementById('recentM_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_02.gif)';	
				document.getElementById('recentR_'+i).style.background = 'url(/templates/site61/dino/images/recent_nomorl_03.gif) no-repeat';
			}
		}
		document.getElementById("recent_"+ct).className = 'this';
		document.getElementById('recentL_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_01.gif) no-repeat';	
		document.getElementById('recentM_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_02.gif)';	
		document.getElementById('recentR_'+ct).style.background = 'url(/templates/site61/dino/images/recent_down_03.gif) no-repeat';
	}
}

function checkMin(){
	var MinPrice=document.getElementById("MinPrice").value;	
	if(isNaN(MinPrice)){
		if(isNaN(MinPrice.substring(0,1))){
				document.getElementById("MinPrice").value = "";
			}else{
				document.getElementById("MinPrice").value = parseFloat(document.getElementById("MinPrice").value);
			}
	}
	
}

function checkMax(){
	var MaxPrice=document.getElementById("MaxPrice").value;	
	if(isNaN(MaxPrice)){
		if(isNaN(MaxPrice.substring(0,1))){
				document.getElementById("MaxPrice").value = "";
			}else{
				document.getElementById("MaxPrice").value = parseFloat(document.getElementById("MaxPrice").value);
			}
	}
	
}

function colorsh(id,sta){
	if(sta==0){
		if(document.getElementById('recent_'+id).className != 'this'){
			 document.getElementById('recentL_'+id).style.background = 'url(/templates/site61/dino/images/recent_on_01.gif) no-repeat';	
			 document.getElementById('recentM_'+id).style.background = 'url(/templates/site61/dino/images/recent_on_02.gif)';	
			 document.getElementById('recentR_'+id).style.background = 'url(/templates/site61/dino/images/recent_on_03.gif) no-repeat';
		}
	}else{
		if(document.getElementById('recent_'+id).className != 'this'){
			 document.getElementById('recentL_'+id).style.background = 'url(/templates/site61/dino/images/recent_nomorl_01.gif) no-repeat';	
			 document.getElementById('recentM_'+id).style.background = 'url(/templates/site61/dino/images/recent_nomorl_02.gif)';	
			 document.getElementById('recentR_'+id).style.background = 'url(/templates/site61/dino/images/recent_nomorl_03.gif) no-repeat';
		}
	} 
}


