var brwheight = screen.availheight;var brwwidth = screen.availwidth;var browser=navigator.appName.toLowerCase();var IE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;var FF = navigator.userAgent.toLowerCase().indexOf('firefox') != -1;var isSafari3 = false;if(window.devicePixelRatio) isSafari3 = true;var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var pageurl = document.location.pathname.toLowerCase();
var goodbrwsr = ((((browser == "microsoft internet explorer") && (document.documentMode > 7)) || (is_chrome) || (isSafari3) || (FF)) && (IE6 == false)) ? 1 : 0;

var color = new Array();color[0]="#000";color[1]="#fff";color[2]="#f9f9f9";color[3]="#666";color[4]="#333";color[5]="#f6efe5";color[6]="#76b3d0";color[7]="#cc6a67";color[8]="#ccb795";color[9]="#ccb895";color[10]="#948771";color[11]="#6c5e46";color[12]="#847761";color[13]="#635541";color[14]="#847161";color[15]="#3d6184";color[16]="#7da1c3";color[17]="#b2cbe5";color[18]="#679a8a";color[19]="#3f7363";color[20]="#5b8d7d";color[21]="#5b8d7d";color[22]="#edf3f9";color[100]="url(/_site/_images/nav/bg_headnavon.gif) repeat-x top left";color[101]="url(/_site/_images/nav/bg_subcatnavon.gif) repeat-x top left";var this_sw;var navcoloron=color[15];var navcoloroff=color[16];var nav1coloron=color[15];var nav1coloroff=color[17];var nav2coloron=color[19];var nav2coloroff=color[18];var nav3coloron=color[2];var nav3coloroff=color[1];var nav4coloron=color[11];var nav4coloroff=color[13];var nav5coloron=color[19];var nav5coloroff=color[18];var thiscolor;var nav_lev3on=color[6];var nav_lev3off=color[1];var nav_lev3act="nav3_1";

var def_shopby;
var def_subcat; 
var lyrobc = 2;
var lyrobs = new Object();
var lyrobsnav = new Object();
lyrobs[0] = "panel_1";lyrobsnav[0] = "z_1";
lyrobs[1] = "panel_2";lyrobsnav[1] = "z_2";
lyrobs[2] = "panel_3";lyrobsnav[2] = "z_3";
var curron = lyrobs[0];var curronnav = lyrobsnav[0];
defcolor = color[18];

String.prototype.contains = function(t) { return this.indexOf(t) >= 0 ? true : false; }

function setpage(){ }

//COOKIES
function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString() + "; path=/"); }
function getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){  c_start=c_start + c_name.length+1;  c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); }  } return ""; }

function rec_last(pn){
	var rlVar = new String (pn.toLowerCase());
	if(rlVar.contains('error.aspx')){
		//DONT UPDATE
	} else {
		var set_pn = setCookie("lpg",pn,15);
	}
}

//LOADINGIMG
//var loadimg = new Image();
//loadimg.src = "/_site/_images/misc/loading_amin.gif";
function openWindow(winid,productID){
	//FORWARD TO FRIEND
	if(winid == "f"){
		window.open('/catalog/TellFriend/Tell_Friend.aspx?productID=' + productID, 'tellFriend', 'width=600,height=600');
	}
	//SHOPPING SPREE
	if(winid == "x"){
		window.open('/shoppingspree/shoppingspree_friend.aspx', 'shopspree', 'width=600,height=525');
	}
}

//PRINT VIEW FOR PROD DETAIL IMAGES
function printview(x){
	var prodimgdir = "";
}

function setiniproddet(q){
	if(doc_loaded == "true"){
		toggleImage('Image1');
		setGAview('d',q);
	}
}

var navid;
var thiscolor = "#333";
function navon(navid) {
	this_sw = navid.charAt(0);
	var dnavido = document.getElementById(navid).style;
	if (this_sw == "l"){
		thiscolor = navcoloron;
	} else if (this_sw == "x"){
		thiscolor = nav1coloron;
	} else if (this_sw == "c"){
		thiscolor = nav2coloron;
		dnavido.backgroundImage = "none";
	} else if (this_sw == "s"){
		thiscolor = nav3coloron;
	} else if (this_sw == "d"){
		thiscolor = nav4coloron;
	} else if (this_sw == "n"){
		thiscolor = nav4coloron;
	} else if (this_sw == "p"){
		thiscolor = nav5coloron;
	} else if (this_sw == "z"){
		thiscolor = navcoloron;
	}
	dnavido.backgroundColor = thiscolor;
}

function navoff(navid) {
	this_sw = navid.charAt(0);
	var dnavid = document.getElementById(navid).style;
	if (curronnav != navid){
		if (this_sw == "l"){
			thiscolor = navcoloroff;
		} else if (this_sw == "x"){
			thiscolor = nav1coloroff;
		} else if (this_sw == "c"){
			thiscolor = nav2coloroff;
			dnavid.background = thiscolor + " url(/_site/_images/nav/bg_header3.gif) repeat-x bottom left";
		} else if (this_sw == "s"){
			thiscolor = nav3coloroff;
		} else if (this_sw == "d"){
			thiscolor = nav4coloroff;
		} else if (this_sw == "n"){
			thiscolor = nav4coloroff;
		} else if (this_sw == "p"){
			thiscolor = nav5coloroff;
		} else if (this_sw == "z"){
			thiscolor = navcoloroff;
		}
		if(this_sw != "c"){
			dnavid.backgroundColor = thiscolor;
		}
	} else {
		dnavid.backgroundColor = defcolor;
	}
}

function showcont(){
	var thistext = document.getElementById('text1').innerHTML;
}

var defloc = 0;
var curloc = 0;
var incloc = 50;
function setmovloc(x){
	curloc = eval("curloc" + x + "incloc");
	moveloc('g');
}

function moveloc(x){
	var dcurron = document.getElementById(curron).style;
	if((curloc <= 0) && (x == 'g')){
		dcurron.top = curloc + "px";
	} else {
		dcurron.top = defloc;
		curloc = defloc;
	}
}
	
	var z;
//PAGELOAD INI SET
var doc_loaded = "false";
var bpg = "na";
function page_def(x){
	doc_loaded = "true";
	def_shopby = x;
	set_cnav(x);
	var set_lastp = rec_last(pageurl);
	if(bpg == "hp"){
		//chg_ad();
		//swpsi('a');
		//swtchmh('ini');
	}
	if(pageurl.contains('poshcategory.aspx') && !pageurl.contains('nurseries-for') && !pageurl.contains('bedrooms-for')){
		chg_ad();
	}
	if(pageurl.contains('poshproductdetail.aspx')){
		reset_pdlm('ini');
		//chg_ad();
		chck_details('ini');
	}
	if(pageurl.contains('10yearcelebration.aspx')){
		setini();
	}
	if(pageurl.contains('productlist.aspx') && !pageurl.contains('designer-rooms')){
		pltxtsize(0);
	}
}

	
//HEADER NAVIGATION PANELS
//042810 JAH
var timenavup = "";
var thishnavp = "";
var thisnavs = 0;
var thisnid = "";
var timenpanup = "";

function hnavsh(nid,s){
//	clearTimeout(timenavup);
//	thisnid = nid;
//	thishnavp = nid.replace("hn_","hngrp_");
//	thisnavs = s;
//	docartshow("h");
//	if((s != 1) && (s != 3)){
//		timenavup = setTimeout('timenavupf()',1000);
//	} else {
//		clearTimeout(timenavup);
//		timenavupf();
//	}
}

function timenavupf(){
	clearTimeout(timenavup);
	clearTimeout(timenpanup);
	for(c=0;c<=cnl;c++){
		var thiscnag = "hngrp_"+c;
		var thiscpid = "hn_"+c;
		if(document.getElementById(thiscnag)){
			document.getElementById(thiscnag).style.display = "none";
			var pnid1 = document.getElementById(thiscpid);
			if(!pnid1.innerHTML.toLowerCase().contains("sale")){
				if(c != cna){
					pnid1.style.color = "#666666";
				} else {
					pnid1.style.color = "#76b3d0";
				}
			} else {
				pnid1.style.color = "#ea80a8";
			}
		}
	}
	if(thisnavs != 3){
		if(document.getElementById(thishnavp)){
			var didnum = thishnavp.replace("hngrp_","");
			var pnid = document.getElementById("hn_"+didnum);
			if(thisnavs == 1){
				timenpanup = setTimeout('shownavm(thishnavp)',1000);
				if(!pnid1.innerHTML.toLowerCase().contains("sale")){
					if(didnum != cna){
						pnid.style.color = "#333333";
					} else {
						pnid.style.color = "#4f83a1";
					}
				} else {
					pnid1.style.color = "#ea80a8";
				}
			}
		}
	}
}
function shownavm(mnid){
	document.getElementById(mnid).style.display = "block";
}


var navaction;
function set_cnav(x){
	clearTimeout(navtimer);
	var d_chng = 'updt_nav(' + x + ')';
	navaction = setTimeout(d_chng,500);
	docartshow("h");
}

//DEFAULT STATUS OF TOP LEVEL NAVIGATION
function updt_nav(x){
	var navcount = 4;
	for (i=1;i<=navcount;i++){
		if(i <= navcount){
			document.getElementById('navc'+i).style.display = "none";
		}
		if(i != def_shopby){
			var navtiobj = document.getElementById('nav_t'+i).style;
				navtiobj.color = "#777777";
				navtiobj.background = "#fae1ea";
				navtiobj.top = "0px";
				navtiobj.padding = "2px 14px 3px 14px";
			if (isSafari3 && !is_chrome){
				navtiobj.paddingTop = "2px";
				navtiobj.paddingBottom = "5px";
			}
		}
	}		
	//SET CURR
	if(x<=navcount){
		//DEFAULT VISIBILITY OF MAIN NAV
		var navcobj = document.getElementById('navc'+x).style;
			navcobj.display = "block";
	} else {
		var navcobj = document.getElementById('navc1').style;
			navcobj.display = "block";
	}
	if(document.getElementById('nav_t'+x)){
		var navtxobj = document.getElementById('nav_t'+x).style;
			navtxobj.font = "11px georgia";
			navtxobj.color = "#ea80a8";
			navtxobj.background = "#ffedf3";
			navtxobj.top = "-5px";
			navtxobj.padding = "7px 14px 5px 14px";
		if(x == def_shopby){
			navtxobj.position = "relative";
			navtxobj.top = "-6px";
			navtxobj.font = "11px georgia";
			navtxobj.background = "#ffffff";
			navtxobj.borderLeft = "1px solid #f8d8e4";
			navtxobj.borderRight = "1px solid #f8d8e4";
			navtxobj.borderTop = "1px solid #f8d8e4";
			navtxobj.color = "#76b3d0";
			navtxobj.padding = "7px 14px 5px 14px";
		}
		if (isSafari3 && !is_chrome){
			navtxobj.paddingTop = "2px";
			navtxobj.paddingBottom = "5px";
		}
	}
}

function navrollpanel(p,s){
	var sh = "block";
	if(s == "h"){
		sh = "none";
	}
	document.getElementById("navmenu_"+p).style.display = sh;
}

//SEARCHBOX CLEAR INI CONTENTS
function cleartxt(frmtxtid){
	var thistxtbx = document.getElementById(frmtxtid);
	if(thistxtbx.value.contains("Keyword")){
		thistxtbx.value = "";
		thistxtbx.style.font = "bold 12px arial";
		thistxtbx.style.color = "#333";
	}
}


var carttmo;
function cartpreview(y,z){
	if(goodbrwsr != 0){
		clearTimeout(carttmo);
		if(z != 0){
			timenavupf();
		}
		if(y == "s"){
			carttmo = setTimeout("docartshow('s')",250);
		} else {
			carttmo = setTimeout("docartshow('h')",2000);
		}
	} else {
		if(y == "s"){
			window.location = "/ShopCart/PoshShoppingCart.aspx";
		}
	}
}
function docartshow(x){
	clearTimeout(carttmo);
	var dqc = document.getElementById('qc_contain').style;
	if(x == "s"){
		if(!document.getElementById('noprd')){
			dqc.display = "block";
		}
	} else {
		dqc.display = "none";
	}
}

function gocart(a){
	var thiscartlnk = document.getElementById('head_pram');
	if(a == "l"){
		document.location = "/ShopCart/PoshShoppingCart.aspx";
	} else if(a == "r"){
		thiscartlnk.style.cursor = "pointer";
	} else {
		thiscartlnk.style.cursor = "default";
	}
}

// CUSTOMER SERVICE PANEL DISPLAY CONTROL
function switch1(div) {
	var option=['initial','safety','placing','payment','status','international','security','terms','shipping','receiving','returns','cancellations','warranty','swatch','custom','certificates','catalogue','pricing','designerrooms','newsletters','slingsafety'];
	var option_2 =['ini','saf','pla','pay','sta','int','sec','ter','shi','rec','ret','can','war','swa','cus','cer','cat','pri','des','new','slg'];
	var option_3 =['aini','asaf','apla','apay','asta','aint','asec','ater','ashi','arec','aret','acan','awar','aswa','acus','acer','acat','apri','ades','anew','aslg'];
	var act_div = div;
	var tra_div;
	var arr_div;
	for(x=0;x<option.length;x++){
		if(act_div == option[x]){
			tra_div = option_2[x];
			arr_div = option_3[x];
			break;
		}
	}
	for(i=0;i<option.length;i++) {
		if (document.getElementById(option[i])) {
			obj=document.getElementById(option[i]);
			obj.style.display=(option[i]==div) ? "block" : "none";
			if (document.getElementById(option_2[i])){
				obj1=document.getElementById(option_2[i]);
				//obj1.style.textDecoration=(option_2[i]==tra_div) ? "none" : "none";
				obj1.style.fontWeight=(option_2[i]==tra_div) ? "bold" : "normal";
				obj1.style.color=(option_2[i]==tra_div) ? "#e7759f" : "#777777";
			}
			if (document.getElementById(option_3[i])){
				obj2=document.getElementById(option_3[i]);
				obj2.style.backgroundImage=(option_3[i]==arr_div) ? "url(/_site/_images/nav/arrow_lftmenu.png)" : "url()";
			}
		}
	}
	_gaq.push(['_trackPageview', "CustomerService "+div ]);
}
//CS_INTSHIPPING PRODUCT WEIGHTS TABLE
function sh_prodweightstable(x){
	document.getElementById('cs_int_weightcontain').style.display=x;
}


//QUICK CART NAVIGATION
var curr_on = "x";
function quickcart(x){
	var oqca = document.getElementById('quick_cart').style;
	var inca = document.getElementById('in_cart').style;
	var infa = document.getElementById('in_favs').style;	
	if(curr_on != x){
		if(x == "c"){
			window.frames['quick_view'].location.href = "quickcart.htm";
			oqca.visibility = "visible";
			inca.fontWeight = "bold";
			infa.fontWeight = "normal";
			curr_on = "c";
		} else if(x == "f") {
			window.frames['quick_view'].location.href = "quickfavs.htm";
			oqca.visibility = "visible";
			inca.fontWeight = "normal";
			infa.fontWeight = "bold";
			curr_on = "f";
		} else {
			oqca.visibility = "hidden";
			inca.fontWeight = "normal";
			infa.fontWeight = "normal";
			curr_on = "x";
		}
	} else {
		oqca.visibility = "hidden";
		inca.fontWeight = "normal";
		infa.fontWeight = "normal";
		curr_on = "x";
	}
}

var timer = 0;
var navtimer;
function set_navt(){
	timer = 1;
	navtimer = setTimeout('set_cnav('+ def_shopby +')',2500);
}
function reset_navt(){
	clearTimeout(navtimer);
	clearTimeout(navaction);
	set_navt();
}

//LAYER OVERLAY CONTENT ------------------------------------------
function open_extras(x,y,z){
	if (x == "d"){
		var w = prod;
		var dimg = sl(w,x,y);
		var dxtrad = document.getElementById("xtra_t").style;
		var dxtrav = document.getElementById("xtraval").style;
		dxtrav.background = "#fff url(/_site/_images/misc/bg_flourish.gif) no-repeat top left";
		document.getElementById("xtraval").innerHTML = dimg;
		dxtrad.visibility = "visible";
		set_overlay('visible');
		_gaq.push(['_trackEvent', "DETAIL_VIEW", 'click', w, '1']);
	} else if (x == "s"){
		//prod_swatch
		//alert(y);
		var w = prod;
		var dimg = sl(w,x,y);
		var dxtrad = document.getElementById("xtra_t").style;
		var dxtrav = document.getElementById("xtraval").style;
		dxtrav.background = "#fff url(/_site/_images/misc/bg_flourish.gif) no-repeat top left";
		document.getElementById("xtraval").innerHTML = "<div style='padding:5px 0 0 0; font:italic 15px georgia;'>"+z+"</div>"+dimg;
		dxtrad.visibility = "visible";
		set_overlay('visible');
		_gaq.push(['_trackEvent', "SWATCH_VIEW", 'click', w, '1']);
	} else if (x == "l"){
		_gaq.push(['_trackEvent', "NAV_CAT", 'click', y, '1']);
	}
}

function set_overlay(v){
	var dobjov = document.getElementById('overlay').style;
	if(v == "visible"){
		var scrhgt = screen.height+900+"px";
		dobjov.height = scrhgt;
		dobjov.opacity = '.6';
		dobjov.filter = 'alpha(opacity=60)';
		dobjov.display = "block";
	} else {
		dobjov.display = "none";
	}
	dobjov.visibility = v;
	if((IE6) && (document.getElementById("cart_options"))){
		document.getElementById("cart_options").style.visibility = "hidden";
	}
}

function close_overlay(){
	set_overlay('hidden');
	var dxtrad = document.getElementById("xtra_t").style;
	var dxtrav = document.getElementById("xtraval").style;
	dxtrav.background = "#fff";
	dxtrad.visibility = "hidden";
	//document.getElementById("loadingtxt").style.visibility = "hidden";
	if((IE6) && (document.getElementById("cart_options"))){
		document.getElementById("cart_options").style.visibility = "visible";
	}
}

var imindv;
function sl(w,x,y){
	if(x == "l"){
		var txt1 = "<div style='margin:0 auto 0 auto; padding:0 0 7px 0;'><img src='/_site/_images/misc/loading_amin.gif'/></div><div style='font:italic 10px georgia; padding:0 0 4px 0;'>Loading</div><div style='line-height:11px;'>";
		var txt2 = "</div><div style='font:8px arial; color:#ccc; padding:7px 0 9px 0;'>CANCEL</div>";
		var as1 = txt1 + y + txt2;
		return (as1);
	}
	if(x == "d"){
		var dttl = "<h2 class='prod_title'>" + w + "</h2>";
		var img1 = "<div style='position:relative;margin:0 auto 0 auto;width:500px;height:500px;background:#fff;'><img src='";
		var img2 = "' class='prdimgdtl' id='detimgon' alt='Click Image to Close' onclick='javascript:close_overlay();' /><div class='roundcorner_left'></div><div class='roundcorner_right'></div><div class='roundcorner_bleft'></div><div class='roundcorner_bright'></div></div>";
		var prnt1 = "<div class='linkcon'><div class='linkpnl'><a href='#swatchpanel' onclick='javascript:close_overlay();'>CLOSE</a></div><div class='linkpnl'><a href='javascript:printpg(\"i\");'>PRINT</a></div><div class='linkpnl'><a href='javascript:gonxtprvimg(\"p\");'>PREVIOUS</a></div><div class='linkpnl'><a href='javascript:gonxtprvimg(\"n\");'>NEXT</a></div></div>";
		imindv = "<img src='" + y + "'/>";
		var im1 = "<div style='z-index:99999999999;'>" + dttl + prnt1 + img1 + y + img2 + prnt1 + "<div style='color:#ccc'><span id='cntnum'>1</span><span id='totnum'></span></div></div>";
		return (im1);
	}
	if(x == "s"){
		var dttl = "<h2 class='prod_title'>" + w + "</h2>";
		var img1 = "<img src='";
		var img2 = "' class='prdimgdtl' id='detimgon' alt='Click Image to Close' onclick='javascript:close_overlay();backtoswtch();' />";
		var prnt1 = "<div class='linkcon'><div class='linkpnl'><a href='#swatchpanel' onclick='javascript:close_overlay();backtoswtch();'>CLOSE</a></div><div class='linkpnl'><a href='javascript:printpg(\"i\");'>PRINT</a></div></div>";
		imindv = "<img src='" + y + "'/>";
		var im1 = "<a name='swtchover'></a><div style='z-index:99999999999;'>" + dttl + prnt1 + img1 + y + img2 + prnt1 + "<div style='color:#ccc' id='cntnum'></div></div>";
		return (im1);
	}
}

function printpg(t){
	var prddtlwin = window.open("","PTSprddtl","width=20px,height=20px,scrollbars=0,resizable=0,status=0,menubar=0,toolbar=0,left=0,screenx=0,top=0,screeny=0")
	var text = "<div style='font:14px georgia;padding:10px;'>"+ prod +" at PoshTots.com.</div>";
	var text2 = "<div style='padding:0 0 0 10px;font:10px verdana;'>Call toll-free 1-866-POSHTOT (866-767-4868) to speak with a Design Consultant.</div>";
	var html = "<html><head><title>PoshTots.com : " + prod +"</title><script language='javascript'>function prnt(){ if(window.print){ window.print(); } else { var wb = '<OBJECT ID=\"wb1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', wb); wb1.ExecWB(6, 2); wb1.outerHTML = ''; } window.close(); }</script></head><body onload='prnt();'>";
	if(t == "i"){ //PRINT INDIVIDUAL IMAGE - POPUP
		text += "<div style='padding:15px;'>" + imindv + "</div>";
		html += text + text2;
	}
	if(t == "a"){ //PRINT ALL IMAGES - PAGE DETAIL IMG SELECTION
		var strngimgs = "";
		for(i=1;i<=9;i++){
			var thisichk = 'mImage'+i;
			if(document.getElementById(thisichk)){
				var thisimgsrc = document.getElementById(thisichk).src;
				//alert(thisimgsrc);
				strngimgs += "<div><img src='" + thisimgsrc + "' width='500' height='500' border='0' /></div>";
			} else {
				break;
			}
		}
		html += text + strngimgs + text2;
	}
	html += "</body></html>";	
	
	prddtlwin.document.open();
	prddtlwin.document.write(html);
	prddtlwin.document.close();
}

/* FROM CONTENTPAGE.MASTER */
function pageLoad() { }
function PageLoaded()
{
 //alert("hey");
 //Sys.Debug.trace("Page Loaded");
 //Sys.Debug.fail("Start Debugging");            
}

/* ----------------- PRODUCT DETAIL PAGE */

	/* HIGHLIGHT FUNCTIONALITY JAH 0410 */
		var reslm;
		var holdi = 0;
		var n = 0;
		var lrgint = 0;
		var chngimg = 0;
		var fr = 0;
		var tothigh = 9;
		var defsize = 35;
		var onsize = 45;
		var hidesmmenu;
		
		function pdlm_resetsmmenu(){
			clearTimeout(hidesmmenu);
			hidesmmenu = setTimeout("show_detailimgs('x')",1000);
		}
		
		var currpimg = "";
		function pdlm_pimg(imgnm,status){
			clearTimeout(reslm);
			clearTimeout(hidesmmenu);
			n=0;
			var thisimgsrc = "mImage"+imgnm.replace("pd_i","");
			var dimgsrc = document.getElementById(imgnm);
			if(thisimgsrc != currpimg){
				for(im=1;im<=tothigh;im++){
					if(document.getElementById("pd_i"+im)){
						var pdiimgs = document.getElementById("pd_i"+im).style;
							pdiimgs.border = "1px solid #ddd";
							pdiimgs.width = defsize+"px";
							pdiimgs.height = defsize+"px";
							pdiimgs.top = "0px";
							pdiimgs.opacity = .7;
							pdiimgs.filter = 'alpha(opacity=70)';
						var mainimgs = document.getElementById("mImage"+im).style;
							mainimgs.opacity = 0;
							mainimgs.filter = 'alpha(opacity=0)';
							mainimgs.display = "none";
					} else {
						break;
					}
				}
				dimgsrc.style.border = "1px solid #888";
				dimgsrc.style.width = onsize+"px";
				dimgsrc.style.height = onsize+"px";
				dimgsrc.style.top = ((onsize-defsize)*-1)+"px";

				var pdiimgs2 = document.getElementById(imgnm).style;
				pdiimgs2.opacity = 1;
				pdiimgs2.filter = 'alpha(opacity=100)';

				if(status == "h"){
					holdi = 1;
				} else {
					holdi = 0;
				}
				swaplrgimg(thisimgsrc);
				currpimg = thisimgsrc;
			}
		}

		function reset_pdlm(x){
			if(holdi == 0){
				if(x == "p"){
					//reslm = setTimeout("pdlm_pimg('pd_i1','s')",2500);
				} else {
					//pdlm_pimg('pd_i1','s');
				}
			}
		}
		
		function swaplrgimg(ximg){
			var thislmimg = document.getElementById(ximg).style;
			thislmimg.display = "block";
			
			if(chngimg == 0){
				lrgint = setInterval("fadelrgimg('"+ximg+"')",10);
				chngimg = 1;
			} else {
				clearInterval(lrgint);
				chngimg = 0;
				n = 0;
				fr = 0;
				swaplrgimg(ximg);
			}
		}
		
		function fadelrgimg(idnm){
			var thislmimgb = document.getElementById(idnm).style;
			n++;
			fr = n*5;
			if(fr<=100){
				thislmimgb.opacity = fr/100;
				thislmimgb.filter = 'alpha(opacity='+fr+')';
			} else {
				clearInterval(lrgint);
				chngimg = 0;
				n = 0;
				fr = 0;
			}
		}
		
		var shdi = "h";
		function show_detailimgs(x){
			clearTimeout(hidesmmenu);
			var pdpanel = document.getElementById("pd_lm_icont").style;
			var pdarrws = document.getElementById("pd_lm_arrws").style;
			if(x != "x"){
				//shdi = (x=="h") ? "s":"h";
				shdi = x;
			}
			if(shdi == "h"){
				pdpanel.display = "block";
				pdarrws.width = "25px";
				pdarrws.background = "url(/_site/_images/nav/pd_lm_showhide.png) no-repeat -95px 2px";
				shdi = "s";
			} else {
				pdpanel.display = "none";
				pdarrws.width = "90px";
				pdarrws.background = "url(/_site/_images/nav/pd_lm_showhide.png) no-repeat 5px 2px";
				shdi = "h";
			}
		}
		
		function showbopanel(tid){
			document.getElementById(tid.replace("lnk","")).style.display = "block";
			document.getElementById(tid).style.display = "none";
		}
		
	/*---*/
	
	
/* ----------------- PRODUCT LIST PAGE */
function prdroll(pln,s){
	var thispln = document.getElementById('p'+pln).style;
	var thiscnr = document.getElementById('prdscrnrs'+pln).style;
	if(s == 1){
		thispln.border = "1px solid #edf5f9";
		thiscnr.display = "block";
	} else {
		thispln.border = "1px solid #fff";
		thiscnr.display = "none";
	}
}

//NAV CONTROL FOR PRODUCT LIST TXT ZONE EXPAN COLLAPSE
function pltxtsize(x){
	var dcval = getCookie("ptsplp");
	var ptsplpv = ((dcval == "") || (dcval == null)) ? 1 : dcval;
	var updpnl = (x == 1) ? 1 : 0;
	var ptxtz = document.getElementById('prdlst_vndtxt');
	var ptxct = document.getElementById('plvt_minmax');
	if(updpnl != 0){
		ptsplpv = (ptsplpv == 1) ? 0 : 1;
	}
	if(ptsplpv == 1){
		ptxtz.style.display = "block";
		ptxct.innerHTML = "[ - ]";
	} else {
		ptxtz.style.display = "none";
		ptxct.innerHTML = "[ + ]";
	}
	var ptsc = setCookie("ptsplp",ptsplpv,15);
}



function PanelClick(sender, e) {
	//var Messages = $get('<Messages.ClientID');
	//Highlight(Messages);
}

function ActiveTabChanged(sender, e) {
	//var CurrentTab = $get('<CurrentTab.ClientID');
	//CurrentTab.innerHTML = sender.get_activeTab().get_headerText();
	//Highlight(CurrentTab);
}

var HighlightAnimations = {};
function Highlight(el) {
	if (HighlightAnimations[el.uniqueID] == null) {
		HighlightAnimations[el.uniqueID] = AjaxControlToolkit.Animation.createAnimation({
			AnimationName : "color",
			duration : 0.5,
			property : "style",
			propertyKey : "backgroundColor",
			startValue : "#FFFF90",
			endValue : "#FFFFFF"
		}, el);
	}
	HighlightAnimations[el.uniqueID].stop();
	HighlightAnimations[el.uniqueID].play();
}

function ToggleHidden(value) {
	//$find('<Tabs.ClientID').get_tabs()[2].set_enabled(value);
}

var setsz = 0;
var txtsize = "t";
function settxtsize(){
	var txtsz1 = document.getElementById('text1');
	var txtsz2 = document.getElementById('text2');
	var txtsz3 = document.getElementById('text3');
	//CHECK TO SEE IF SIZE IS ALREADY SET VIA COOKIE VALUE
	txtsz1.style.fontSize == "13px" ? setsz=1 : setsz=0;
	if(setsz == 0){
		txtsz1.style.fontSize = "13px";
		txtsz1.style.lineHeight = "19px";
		txtsz2.style.fontSize = "13px";
		txtsz2.style.lineHeight = "19px";
		txtsz3.style.fontSize = "13px";
		txtsz3.style.lineHeight = "19px";
		txtsize = "tlrg";
		setsz = 1;
	} else {
		txtsz1.style.fontSize = "11px";
		txtsz1.style.lineHeight = "15px";
		txtsz2.style.fontSize = "11px";
		txtsz2.style.lineHeight = "15px";
		txtsz3.style.fontSize = "11px";
		txtsz3.style.lineHeight = "15px";
		txtsize = "t";
		setsz = 0;
	}
	var set_ts = setCookie("txtsz",txtsize,15);
}


//JAH052108 FIX FOR DETAIL IMAGES AND SWATCHES
var this_thumb;
var thisnumimg = 0;
function toggleImage(thumbnail){
	if(thumbnail != "Image1"){
		thisnumimg = thumbnail.id.charAt(thumbnail.id.length-1);
		this_thumb = thumbnail.src;
	} else {
		thisnumimg = 1;
		this_thumb = document.getElementById('Image1').src;
	}
	var chr_count = 3;
	var this_lngth = this_thumb.length;
	var curr_cnum = 0;
	var this_grp = "";
	var new_url = "";
	for (i=0;i<eval(this_lngth);i++){
		curr_cnum = i;
		this_grp = this_thumb.substring(curr_cnum,eval(curr_cnum + chr_count));
		if(this_grp == "_CT"){
			this_grp = "_CD";
			new_url = new_url + this_grp;
			i = i+2;
		} else {
			new_url = new_url + this_grp.charAt(0);
		}
	}
	var show_detail = open_extras('d',new_url,thisnumimg)
}

//JAH0510 SWATCH PANEL EXPANSION
var d = 0;
function shwallswtch(){
	var pdcc = document.getElementById('swtchpanel').style;
	var pdic = document.getElementById('pd_swatchp_item').style;
	var pdin = document.getElementById('pd_swatchp_viewall');
	if(d == 1){
		pdcc.height = "135px";
		//pdic.overflow = "auto";
		pdic.height = "102px";
		pdin.innerHTML = "View All";
		d = 0;
	} else {
		pdcc.height = "auto";
		//pdic.overflow = "hidden";
		pdic.height = "auto";
		pdin.innerHTML = "View Less";
		d = 1;
	}
}

//PRODUCTDETAIL NEXT-PREVIOUS FUNCTIONALITY
var maximg = 9;
function setmaximg(){
	for(d=1;d<=maximg;d++){
		if(document.getElementById("Image"+d)){
			var chktimg = document.getElementById("Image"+d).src;
			if(chktimg.contains('spacer.gif')){
				maximg = d;
				break;
			}
		} else {
			maximg = d-1;
			//alert(maximg);
			break;
		}
	}
}
function gonxtprvimg(s){
	if(s == "n"){ thisnumimg++; } else if(s == "p"){ thisnumimg--; }
	if(thisnumimg <= 0){ thisnumimg = 1; }
	if(thisnumimg >= maximg){ thisnumimg = (maximg); }
	if(document.getElementById("Image"+thisnumimg)){
		var nxti = document.getElementById("Image"+thisnumimg).src;
		if(!nxti.contains('spacer.gif')){
			document.getElementById('detimgon').src = nxti;
			document.getElementById('cntnum').innerHTML = thisnumimg;
			document.getElementById('totnum').innerHTML = " of "+maximg;
			imindv = "<img src='" + nxti + "'/>";
		} else { if(s == "n"){ thisnumimg--; } else if(s == "p"){ thisnumimg++; } }
	}
}

function toggleSwatch(thumbnail){
	this_thumb = thumbnail.src;
	this_name = thumbnail.alt;
	var chr_count = 3;
	var this_lngth = this_thumb.length;
	var curr_cnum = 0;
	var this_grp = "";
	var new_url = "";
	for (i=0;i<eval(this_lngth);i++){
		curr_cnum = i;
		this_grp = this_thumb.substring(curr_cnum,eval(curr_cnum + chr_count));
		if(this_grp == "_CT"){ this_grp = "_CD"; new_url = new_url + this_grp; i = i+2; } else { new_url = new_url + this_grp.charAt(0); }
	}
	var show_swatch = open_extras('s',new_url,this_name);
}

function setswon(thumbnail){
	document.location = "#swtchover";
	var theurl = thumbnail.src;
	var thearray = theurl.split("/");
	var imgnmarray = thearray[thearray.length-1].split("_");
	var showi = 0;
	for(var i=0;i<=document.getElementById("ctl00_ContentPlaceHolder1_0").length-1;i++){
		var ddlText = document.getElementById("ctl00_ContentPlaceHolder1_0").options[i].value;
		var ddltxtval = document.getElementById("ctl00_ContentPlaceHolder1_0").options[i].text;
		if((!ddlText.contains('Select')) && !ddltxtval.contains('*COM')){
			showi++;
		}
		if(ddlText == imgnmarray[1]){
			document.getElementById("ctl00_ContentPlaceHolder1_0").selectedIndex = i;
			document.getElementById("ctl00_ContentPlaceHolder1_0").style.border = "1px solid #777";
			document.getElementById(showi).style.border = "1px solid #777";
			i = 0;
			showi = 0;
			break;
		}
	}
}
function backtoswtch(){
	document.location = "#swatchpanel";
}

//CATEGORY PAGE - SHOW 272 PROD NAME ON ROLLOVER
function showprdnm(x){
	var dimgv = document.getElementById('prdnme').style;
	if(x=="v"){ dimgv.visibility = "visible"; } else { dimgv.visibility = "hidden"; }
}
//CATEGORY MAIN IMAGE HIGHLIGHT TEXT CONTROL
var maxalpha = 99;
var minalpha = 0;
var viewpnl = 0;
function drkhpnl(){
	var hpnlv = document.getElementById('cathtxtpnl').style;
	var cpn = document.getElementById('cpnl').style;
	var cb = document.getElementById('catcntrbutt');
	if(viewpnl == 0){
		hpnlv.opacity = maxalpha/100;
		hpnlv.filter = 'alpha(opacity='+maxalpha+')';
		cpn.display = "block";
		cb.innerHTML = "x";
		cb.style.bottom = "56px";
		cb.style.borderBottom = "1px solid #999999";
		viewpnl = 1;
	} else {
		hpnlv.opacity = minalpha;
		hpnlv.filter = 'alpha(opacity='+minalpha+')';
		cpn.display = "none";
		cb.innerHTML = "Product Feature";
		cb.style.bottom = "-20px";
		cb.style.borderBottom = "0px";
		viewpnl = 0;
	}
}


//FAVORITE FINDS - FIX FREE SHIPPING ON BEDDING PRODUCTS
var fstxt = "Free Shipping";
function chkprdfs(w,x,y){
	if (w.contains('Bedding') && (w.contains('Crib') != true) && (w.contains('Bed and') != true) && (pageurl.contains('otherworks.aspx') != true)){
		if(x.contains('Free') != true){
			document.getElementById(y).innerHTML = fstxt;
		}
	} else if(w.contains('Rugs')){
		if(x.contains('Free') != true){
			document.getElementById(y).innerHTML = fstxt;
		}
	}
}

//GOOGLE ANALYTIC VIEW TRACKER -JAH051708
function setGAview(type,prod){
	//alert(type+":"+prod);
	var this_idev = "";
	var this_detail = "";
	if(type == "d"){ this_idev="/__PRODDETAIL__/"; this_detail = this_idev + prod; }
	if(type == "e"){ this_idev="/__PAGEERROR__/"; this_detail = this_idev + prod; }
	if(type == "s"){ this_idev="/__SUBSCRIPTION__/"; this_detail = this_idev + prod; }
	if(type == "c"){ this_idev="/__SOCIALLINK__/"; this_detail = this_idev + prod; }
	if(type == "u"){ this_idev="/__CARTUPSELL__/"; this_detail = this_idev + prod; }
	_gaq.push(['_trackPageview', this_detail]);
	_gaq.push(['_trackEvent', this_idev, 'click', prod, '1']);
}

//LOADING ANIMATION AND VIEW CONTROLS
function chng_load(){ document.getElementById('view_loading').style.visibility = "visible"; document.getElementById('view_loading2').style.visibility = "visible"; }

//BILLMELATER
function goBML() { if(!nw) { var nw = window.open("https://www.securecheckout.billmelater.com/paycapture-content/fetch?hash=W2E28TBW&content=/bmlweb/ni6mrollingiw.html", "BML", "width=503,height=350,location=0,menubar=0,resizable=0,status=0,toolbar=0,scrollbars=1,left=200,top=200"); } else { window.BML.focus(); } }


