// JavaScript Document
function appendman(man) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&ManID');
if (Pathname.indexOf("ManID=0") !=-1) {
	self.location=location.search.replace('ManID=0', 'ManID='+man);

}

else if (Pathname.indexOf("ManID=") !=-1) {
		self.location=location.search.replace(varid3, man);
	var str=location.search.match(/\bManID\= *([^\&]+)/);
	var varid3=str[1];
}



else if (Pathname.indexOf("sortEntity") !=-1) {
	self.location=location+'&ManID='+man;
	
}
else if (Pathname.indexOf("pagesize") !=-1) {
	self.location=location+'&ManID='+man;
	
}
else if (Pathname.indexOf("DistID") !=-1) {
	self.location=location+'&ManID='+man;
	
}
else if (Pathname.indexOf("MaxPrice") !=-1) {
	self.location=location+'&ManID='+man;
	
}
else if (Pathname.indexOf("pagenum") !=-1) {
	var str=location.search.match(/\bpagenum\= *([^\&]+)/);
	var varid3=str[1];
	self.location=location.search.replace("pagenum="+varid3, "pagenum=1")+'&ManID='+man;
	
}


else {
	self.location=location+'?ManID='+man;
}

}

function appenddist(man) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&DistID');
if (Pathname.indexOf("DistID=0") !=-1) {
	self.location=location.search.replace('DistID=0', 'DistID='+man);

}

else if (Pathname.indexOf("DistID=") !=-1) {
		self.location=location.search.replace(varid3, man);
	var str=location.search.match(/\bDistID\= *([^\&]+)/);
	var varid3=str[1];
}



else if (Pathname.indexOf("sortEntity") !=-1) {
	self.location=location+'&DistID='+man;
	
}
else if (Pathname.indexOf("pagesize") !=-1) {
	self.location=location+'&DistID='+man;
	
}

else if (Pathname.indexOf("MaxPrice") !=-1) {
	self.location=location+'&DistID='+man;
	
}
else if (Pathname.indexOf("ManID") !=-1) {
	self.location=location+'&DistID='+man;
	
}
else if (Pathname.indexOf("pagenum") !=-1) {
	var str=location.search.match(/\bpagenum\= *([^\&]+)/);
	var varid3=str[1];
	self.location=location.search.replace("pagenum="+varid3, "pagenum=1")+'&DistID='+man;
	
}


else {
	self.location=location+'?DistID='+man;
}

}

//Clear Filters
function clearMan() {
	var str=location.search.match(/\bManID\= *([^\&]+)/);
	var varid=str[1];
		self.location=location.search.replace(varid, 0);
}
function clearDist() {
	var str=location.search.match(/\bDistID\= *([^\&]+)/);
	var varid=str[1];
		self.location=location.search.replace(varid, 0);
}
function clearMaxPrice() {
	var str=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varid=str[1];
	var maxpricestr=location.search.match(/\bMaxPrice\= *([^\&]+)/);
	var varidmaxprice=maxpricestr[1];

	var minpricestr=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varidminprice=minpricestr[1];
	self.location=location.search.replace("MinPrice="+varidminprice+"&MaxPrice="+varidmaxprice, "MinPrice=0&MaxPrice=999999");
}

function appendpagenumber(pagenumber) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&pagenum');

if (Pathname.indexOf("pagenum=") !=-1) {
	var str=location.search.match(/\bpagenum\= *([^\&]+)/);
	var varid4=str[1];
		self.location=location.search.replace('pagenum='+varid4, 'pagenum='+pagenumber);

}
else if (Pathname.indexOf("ManID") !=-1) {
	self.location=location+'&pagenum='+pagenumber;
}
else if (Pathname.indexOf("SecID") !=-1) {
	self.location=location+'&pagenum='+pagenumber;
}
else if (Pathname.indexOf("SearchTerm") !=-1) {
	self.location=location+'&pagenum='+pagenumber;
}
else if (Pathname.indexOf("sortEntity") !=-1) {
	self.location=location+'&pagenum='+pagenumber;
}
else if (Pathname.indexOf("DistID") !=-1) {
	self.location=location+'&pagenum='+pagenumber;
}
else {
	self.location=location+'?pagenum='+pagenumber;
}
}
function viewall() {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&DistID');
if (Pathname.indexOf("pagesize=") !=-1) {

	var str=location.search.match(/\bpagesize\= *([^\&]+)/);
	var varid1=str[1];
self.location=location.search.replace(varid1, 9999);

}

else if (Pathname.indexOf("pagenum") !=-1) {
	var str2=location.search.match(/\bpagenum\= *([^\&]+)/);
	var varid5=str2[1];

	self.location=location.search.replace("pagenum=", "")+'&pagesize=9999';
}

else if (Pathname.indexOf("sortEntity") !=-1) {
	self.location=location+'&pagesize=9999';
}
else if (Pathname.indexOf("ManID") !=-1) {
	self.location=location+'&pagesize=9999';
}

else {
	self.location=location+'?pagenum=1&pagesize=9999&SearchTerm=&ViewType=1&sortEntity=0&CatID=0&ManID=0';

}

}


function appendsort(sortentity) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&sortEntity');

if (Pathname.indexOf("sortEntity=") !=-1) {
	var str=location.search.match(/\bsortEntity\= *([^\&]+)/);
	var varid4=str[1];
		self.location=location.search.replace(varid4, sortentity);

}
else if (Pathname.indexOf("?") !=-1) {
	self.location=location+'&pagesize=20&sortEntity='+sortentity;
}

else {
	self.location=location+'?pagenum=1&SearchTerm=&ViewType=1&sortEntity='+sortentity+'&CatID=0&ManID=0';

}
}

function appendprice(LowPrice, HighPrice) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&MinPrice');
if (Pathname.indexOf("MinPrice=") !=-1) {
	var str=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varid=str[1];
	var maxpricestr=location.search.match(/\bMaxPrice\= *([^\&]+)/);
	var varidmaxprice=maxpricestr[1];

	var minpricestr=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varidminprice=minpricestr[1];
	self.location=location.search.replace("MinPrice="+varidminprice+"&MaxPrice="+varidmaxprice, "MinPrice="+LowPrice+"&MaxPrice="+HighPrice);
}
else if (Pathname.indexOf("pagenum") !=-1) {
	var str=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varid=str[1];
	var maxpricestr=location.search.match(/\bMaxPrice\= *([^\&]+)/);
	var varidmaxprice=maxpricestr[1];

	var minpricestr=location.search.match(/\bMinPrice\= *([^\&]+)/);
	var varidminprice=minpricestr[1];
	self.location=location.search.replace("MinPrice="+varidminprice+"&MaxPrice="+varidmaxprice, "MinPrice="+LowPrice+"&MaxPrice="+HighPrice);
}
else if (Pathname.indexOf("?") !=-1) {
	self.location=location.search+'&MinPrice='+LowPrice+'&MaxPrice='+HighPrice;
}


else {
	self.location=location+'?MinPrice='+LowPrice+'&MaxPrice='+HighPrice;
}

}


// JavaScript Document

function hideAllDivsFirst() {
		faqD = document.getElementsByTagName('div');
		for(var i=0;i<faqD.length;i++) {
			if(faqD[i].className=="faqTab") {
				faqD[i].style.display = "none";
			}
		}
	}
	function showFAQ(which) {
		hideAllDivsFirst();
		targetDivName = "faq_"+which;
		tabLiName = "tab_"+which;
		document.getElementById(targetDivName).style.display = "block";
	}
	function swapTopTab(whichID,onoff) {
		if(document.getElementById(whichID).className=="tab_sub") document.getElementById(whichID).className = "tab_sub_over";
		else if(document.getElementById(whichID).className=="tab_sub_over") document.getElementById(whichID).className = "tab_sub";
	}
	function hilite(tID) {
		var allD = document.getElementsByTagName('li');
		for(var j=0;j<allD.length;j++) {
			if(allD[j].className=="tab_sub_selected") {
				allD[j].className = "tab_sub";
			}
		}
		var targetContentDiv = tID.split("_")[1];
		document.getElementById(tID).className = "tab_sub_selected";
		showFAQ(targetContentDiv);
	}
	
	
function hideAllDivsFirst2() {
		faqD = document.getElementsByTagName('div');
		for(var i=0;i<faqD.length;i++) {
			if(faqD[i].className=="faqTab2") {
				faqD[i].style.display = "none";
			}
		}
	}
	function hideAllDivsFirst2() {
		faqD = document.getElementsByTagName('div');
		for(var i=0;i<faqD.length;i++) {
			if(faqD[i].className=="faqTab") {
				faqD[i].style.display = "none";
			}
		}
	}
	function showFAQ2(which) {
		hideAllDivsFirst2();
		targetDivName = "faq_"+which;
		tabLiName = "tab_"+which;
		document.getElementById(targetDivName).style.display = "block";
	}




function swapTopTab2(whichID,onoff) {
		if(document.getElementById(whichID).className=="tab_sub2") document.getElementById(whichID).className = "tab_sub2_over";
		else if(document.getElementById(whichID).className=="tab_sub2_over") document.getElementById(whichID).className = "tab_sub2";
	}
	function hilite2(tID) {
		hideAllDivsFirst2();
		var Pathname = new String(document.location.search+'');

if (document.location.pathname.indexOf("p-") !=-1) {

		var allD = document.getElementsByTagName('li');
		for(var j=0;j<allD.length;j++) {
			if(allD[j].className=="tab_sub2_selected") {
				allD[j].className = "tab_sub2";
			}
		}
		var targetContentDiv = tID.split("_")[1];
		document.getElementById(tID).className = "tab_sub2_selected";
		showFAQ2(targetContentDiv);
	}
	}

function appendcat(cat) {
var Pathname = new String(document.location.search+'');
var url = window.location.toString();
var anchor_index = url.indexOf('&CatID');
if (Pathname.indexOf("CatID=0") !=-1) {
	self.location=location.search.replace('CatID=0', 'CatID='+cat);

}
else if (Pathname.indexOf("CatID=") !=-1) {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid2=str[1];
		self.location=location.search.replace("CatID="+varid2, "CatID="+cat);
}
else if (Pathname.indexOf("pagenum") !=-1) {
	var pagestr=location.search.match(/\bpagenum\= *([^\&]+)/);
	var pagevarid=pagestr[1];
	
	var str=location.search.match(/\bpagenum\= *([^\&]+)/);
	var varid3=str[1];
	self.location=location.search.replace("pagenum="+pagevarid, 'pagenum=1')+'&SearchTerm=&ViewType=1&sortEntity=0&CatID='+cat+'&ManID=0';
}
else {
	self.location=location+'?pagenum=1&SearchTerm=&ViewType=1&sortEntity=0&CatID='+cat+'&ManID=0';
}

}

function getText(hoo) {
	var A = [], next, T, pa, i;
	if (!hoo) return A;
	if (hoo.nodeType== 3 && /\w+/.test(hoo.data)) A.push(hoo);
	else if (hoo.hasChildNodes()){
		pa= hoo.childNodes, i= 0;
		while (pa[i]){
			next= pa[i++];
			T= next.nodeType;
			if (T== 3) {
				if (/\w+/.test(next.data)) A.push(next);
			}
			else if (T== 1) A=A.concat(arguments.callee(next));
		}
	}
	return A;
}

function listSort(){
	var U= document.getElementsByTagName('ul');
	var L= U.length,tem,A;
	while(L--){
		U2= U[L];
		if(U2.className == "sortableCss"){
			A= getText(U2);
			A.sort(function(a,b){
				a= a.data.toLowerCase().replace(/^ */g,'');
				b= b.data.toLowerCase().replace(/^ */g,'');
				if(a== b)return 0;
				return a > b? 1 : -1;
			})
		}
		while(A.length){
			hoo= A.pop();
			while(hoo && hoo.nodeName!= 'LI') hoo=hoo.parentNode;
			if(hoo) U2.insertBefore(hoo,U2.firstChild);
		}
	}
	
}
//Clear Filters
function clearCat() {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid=str[1];
	self.location=location.search.replace(varid, 0);
}
function clearCatWomen() {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid=str[1];
	self.location=location.search.replace(varid, '3');
}
function clearCatKids() {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid=str[1];
	self.location=location.search.replace(varid, '2');
}
function clearCatMen() {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid=str[1];
	self.location=location.search.replace(varid, '1');
}
function clearCatAcc() {
	var str=location.search.match(/\bCatID\= *([^\&]+)/);
	var varid=str[1];
	self.location='c-4-apparel-accessories.aspx';
}

function clearMan() {
	var str=location.search.match(/\bManID\= *([^\&]+)/);
	var varid=str[1];
		self.location=location.search.replace(varid, 0);
}
function clearSearch() {
	var str=location.search.match(/\bSearchTerm\= *([^\&]+)/);
	var varid=str[1];
	var str2=location.search.match(/\bViewType\= *([^\&]+)/);
	var varid2=str2[1];

	self.location=location.search.replace('SearchTerm='+varid+'&ViewType=0', 'SearchTerm=&ViewType=1');
}

function clearFabric () {
	var str=location.search.match(/\bSearchTerm\= *([^\&]+)/);
	var varid=str[1];
		self.location=location.search.replace(varid, 0);
}
function pricechecker(pcheck) {
	if ((pcheck >= 0) && (pcheck < 10)){
		document.getElementById("10filt").style.display="block";
	}
	if ((pcheck >= 10) && (pcheck < 25)){
		document.getElementById("25filt").style.display="block";
	}
	if ((pcheck >= 25) && (pcheck < 35)){
		document.getElementById("35filt").style.display="block";
	}
	if ((pcheck >= 35) && (pcheck < 50)){
		document.getElementById("50filt").style.display="block";
	}
	if ((pcheck >= 50) && (pcheck < 65)){
		document.getElementById("65filt").style.display="block";
	}
	if ((pcheck >= 65) && (pcheck < 80)){
		document.getElementById("80filt").style.display="block";
	}
	if ((pcheck >= 80) && (pcheck < 100)){
		document.getElementById("100filt").style.display="block";
	}
	if ((pcheck >= 100) && (pcheck < 125)){
		document.getElementById("125filt").style.display="block";
	}
	if ((pcheck >= 125) && (pcheck < 150)){
		document.getElementById("150filt").style.display="block";
	}
	if ((pcheck >= 150) && (pcheck < 175)){
		document.getElementById("175filt").style.display="block";
	}
	if ((pcheck >= 175) && (pcheck < 200)){
		document.getElementById("200filt").style.display="block";
	}
	if ((pcheck >= 200) && (pcheck < 250)){
		document.getElementById("250filt").style.display="block";
	}
	if ((pcheck >= 250) && (pcheck < 300)){
		document.getElementById("300filt").style.display="block";
	}
	if ((pcheck >= 300) && (pcheck < 400)){
		document.getElementById("400filt").style.display="block";
	}
	if ((pcheck >= 400) && (pcheck < 500)){
		document.getElementById("500filt").style.display="block";
	}
		if ((pcheck >= 500) && (pcheck < 750)){
		document.getElementById("750filt").style.display="block";
	}
	if ((pcheck >= 750) && (pcheck < 1000)){
		document.getElementById("1000filt").style.display="block";
	}
	if ((pcheck >= 1000) && (pcheck < 1500)){
		document.getElementById("1500filt").style.display="block";
	}
	if ((pcheck >= 1500) && (pcheck < 2000)){
		document.getElementById("2000filt").style.display="block";
	}
	if ((pcheck >= 2000) && (pcheck < 2500)){
		document.getElementById("2500filt").style.display="block";
	}
	if ((pcheck >= 2500) && (pcheck < 3000)){
		document.getElementById("3000filt").style.display="block";
	}
	if ((pcheck >= 3000) && (pcheck < 4000)){
		document.getElementById("4000filt").style.display="block";
	}
	if ((pcheck >= 4000) && (pcheck < 5000)){
		document.getElementById("5000filt").style.display="block";
	}
	if ((pcheck >= 5000) && (pcheck < 6000)){
		document.getElementById("6000filt").style.display="block";
	}
	if ((pcheck >= 6000) && (pcheck < 7000)){
		document.getElementById("7000filt").style.display="block";
	}
	if ((pcheck >= 7000) && (pcheck < 8000)){
		document.getElementById("8000filt").style.display="block";
	}
	if ((pcheck >= 8000) && (pcheck < 9000)){
		document.getElementById("9000filt").style.display="block";
	}
	if ((pcheck >= 9000) && (pcheck < 10000)){
		document.getElementById("10000filt").style.display="block";
	}
	if ((pcheck >= 10000) && (pcheck < 15000)){
		document.getElementById("15000filt").style.display="block";
	}
	if ((pcheck >= 15000) && (pcheck < 20000)){
		document.getElementById("20000filt").style.display="block";
	}
	if ((pcheck >= 20000) && (pcheck < 30000)){
		document.getElementById("30000filt").style.display="block";
	}
	if ((pcheck >= 30000) && (pcheck < 40000)){
		document.getElementById("40000filt").style.display="block";
	}
	if ((pcheck >= 40000) && (pcheck < 50000)){
		document.getElementById("50000filt").style.display="block";
	}
	if ((pcheck >= 50000) && (pcheck < 80000)){
		document.getElementById("80000filt").style.display="block";
	}

	
	
}
function hideEle(x) {
	document.getElementById(x).style.display = 'none';
}
function showEle(x) {
	document.getElementById(x).style.display = 'block';
}


function poptastic(url)
{
	var newwindow;
	newwindow=window.open(url,'name','height=400,width=500');
	if (window.focus) {newwindow.focus()}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
  
  

