/* ProdCookie.js */
var DaysToLive=60;function setCookie(c,d){if(DaysToLive){var b=new Date();b.setTime(b.getTime()+(DaysToLive*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}var DaysToLiveShort=1;function setCookieShort(c,d){if(DaysToLive){var b=new Date();b.setTime(b.getTime()+(DaysToLiveShort*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.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 eraseCookie(a){createCookie(a,"",-1)};
/* Tooltip.js */
var w=1;var h=1;if(document.getElementById||document.all){document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:0px;top:-1000px;width:1px;height:1px;border:1px solid #888888;background:#DDDDDD;"><img id="ttimg" src="/rugsusa/img/h/s.gif" /></div>')}function gettrailobj(){if(document.getElementById){return document.getElementById("enLargedThumb").style}}function truebody(){return(!window.opera&&document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}function hidetrail(){if(!document.getElementById("enLargedThumb")){return}document.onmousemove="";document.getElementById("ttimg").src="/rugsusa/img/h/s.gif";gettrailobj().visibility="hidden";gettrailobj().left=-1000;gettrailobj().top=0;document.getElementById("enLargedThumb").style.display="none";document.getElementById("enLargedThumb").innerHTML=""}function showtrail(c,a,b){if(!document.getElementById("enLargedThumb")){return}if(navigator.userAgent.toLowerCase().indexOf("opera")==-1&&navigator.userAgent.toLowerCase().indexOf("safari")==-1){w=c;h=a;gettrailobj().visibility="visible";gettrailobj().width=w+"px";gettrailobj().height=h+"px";document.getElementById("ttimg").src=b;document.onmousemove=followmouse;document.getElementById("enLargedThumb").innerHTML=document.getElementById("trailimageid").innerHTML;document.getElementById("enLargedThumb").style.display="block"}}function followmouse(f){if(navigator.userAgent.toLowerCase().indexOf("opera")==-1&&navigator.userAgent.toLowerCase().indexOf("safari")==-1){var b=20;var a=20;if(typeof f!="undefined"){b+=f.pageX;a+=f.pageY}else{if(typeof window.event!="undefined"){b+=truebody().scrollLeft+event.clientX;a+=truebody().scrollTop+event.clientY}}var d=document.all?truebody().scrollLeft+truebody().clientWidth:pageXOffset+window.innerWidth-15;var c=document.all?Math.max(truebody().scrollHeight,truebody().clientHeight):Math.max(document.body.offsetHeight,window.innerHeight);if(b+w+3>d){b=b-w-(20*2)}if(a-truebody().scrollTop+h>truebody().clientHeight){a=a-h-20}gettrailobj().left=b+"px";gettrailobj().top=a+"px"}};

/* Types/js */
var focus=true;var types=new Array();types.w=/\w/;types.w1=/\w+/;types.d=/^\d*$/;types.d1=/^\d+$/;types.file=/\w/;types.date=_is_date;types.null_date=_is_null_date;types.email=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;types.state=_is_state;types.password=_check_password;types.password_verify=_check_password_verify;types.match=_check_password_verify;types.ccard_type=_check_credit_card_type;types.ccard=_check_credit_card_num;types.phone=/\w+/;types.and=_all_or_nothing;types.or=_any;function TypeChecker(){this.check_value=_check_value;this.check_form=_check_form}function _all_or_nothing(c){var a=0;var b=0;for(i=0;i<c.length;i++){if(c[i]!=""){a++}else{b++}}return((a==0)||(b==0))}function _any(a){var b=(a[0]!="");for(i=0;i<a.length;i++){b=b||(a[i]!="")}return b}function _check_password(a){return(a.length>4)}function _check_credit_card_type(f){var a=f[0].toString();var l=f[1].toString();var h=false;var c=/[^\d ]/;h=!c.test(l);if(h){var g=l.replace(/ /g,"");var d=g.length;var k=false;var e=false;var b;switch(a){case"Mastercard":k=(d==16);b=/^5[1-5]/;break;case"Visa":k=(d==16||d==13);b=/^4/;break;case"AmericanExpress":k=(d==15);b=/^3(4|7)/;break;default:b=/^$/}e=b.test(g);h=e&&k}return h}function _check_credit_card_num(g){var f=g;var c=f.replace(/ /g,"");var a=c.length;var e;var d;var b=0;for(digitCounter=a-1;digitCounter>=0;digitCounter--){b+=parseInt(c.charAt(digitCounter));digitCounter--;e=String((c.charAt(digitCounter)*2));for(var h=0;h<e.length;h++){b+=parseInt(e.charAt(h))}}return(b%10==0)}function _check_password_verify(a){x=a[0].toString();y=a[1].toString();if(x==y){return(true)}else{return(false)}}function _is_state(a){return(a.length==2)}function _is_date(a){return Date.parse(a)}function _is_null_date(a){if(a==""){return true}else{return Date.parse(a)}}function _check_value(c,b){if(c.length>1){return types[b](c)}else{var a=new String(val);switch(typeof(types[b])){case"undefined":return false;case"object":return a.match(types[b]);case"function":return types[b](a);default:return false}}}function _check_form(d,a){var c,f,e,b;for(c=0;c<a.length;c++){f="";strFieldnames=a[c][0];fieldnames=strFieldnames.split("|");vals=new Array();has_val=0;for(m=0;m<fieldnames.length;m++){vals[m]=new String(_get_val(d[fieldnames[m]]));if(vals[m].length>0){has_val=1}}if(a[c][3]&&!has_val){continue}if(!this.check_value(vals,a[c][1])){alert(a[c][2]);if(focus){d[fieldnames[0]].focus()}return false}}return true}function _get_val(a){if(!a.type){if(a.length>0){if(a[0].type.match(/radio/i)){focus=false;val="";for(j=0;j<a.length;j++){if(a[j].checked){val=a[j].value}}}}}else{if(a.type.match(/select/i)){val=new String(a.options[a.selectedIndex].value)}else{if((a.type.match(/text/))||(a.type.match(/password/))){val=new String(a.value)}else{if(a.type.match(/file/)){val=new String(a.value)}else{if(a.type.match(/radio/)){val=new String(a.value)}}}}}return val};

/* Util.js */
function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function MM_swapImage(){var e,d=0,b,c=MM_swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2]}}}function MM_swapImgRestore(){var d,b,c=document.MM_sr;for(d=0;c&&d<c.length&&(b=c[d])&&b.oSrc;d++){b.src=b.oSrc}}function MM_preloadImages(){var f=document;if(f.images){if(!f.MM_p){f.MM_p=new Array()}var e,c=f.MM_p.length,b=MM_preloadImages.arguments;for(e=0;e<b.length;e++){if(b[e].indexOf("#")!=0){f.MM_p[c]=new Image;f.MM_p[c++].src=b[e]}}}}function MM_reloadPage(init){if(init==true){with(navigator){if((appName=="Netscape")&&(parseInt(appVersion)==4)){document.MM_pgW=innerWidth;document.MM_pgH=innerHeight;onresize=MM_reloadPage}}}else{if(innerWidth!=document.MM_pgW||innerHeight!=document.MM_pgH){location.reload()}}}function g_openWindow(i,m,b,e,f,a,k,j){if(!m){m=400}if(!b){b=560}if(!e){e="_new"}var d,l,g,c;l="WIDTH="+b.toString();d="HEIGHT="+m.toString();g=",scrollbars="+((f)?"yes":"no");c=",resizable="+((a)?"yes":"no");tool=",toolbar="+((k)?"yes":"no");menu=",menubar="+((j)?"yes":"no");attr=l+","+d+g+c+tool+menu;popupWin=window.open(i,e,attr);popupWin.focus()}function print_page(){if(window.print){window.print()}}function roll_sn(a){a.style.color="#000000"}function unroll_sn(a){a.style.color="#990000"}function positionLetter(){var d=document.getElementById("p-main").offsetHeight;var c=document.getElementById("p-zoom").offsetHeight;var b=3;var a=d+c-b;document.getElementById("p-a").style.top="-"+a+"px";document.getElementById("p-a").style.left=b+"px"}function is_valid_postal_code(a){if(a==null||a.length<5){return false}return true}function is_valid_email_address(a){return(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(a))}function doZoom(a){page="/rugsusa/control/zoomify?prodZoomifyName="+a;height="440";width="280";win=a;scrollbars=false;resizable=false;toolbar=false;menubar=false;g_openWindow(page,height,width,win,scrollbars,resizable,toolbar,menubar)}function doViewLarger(a){page=a;height="410";width="350";win=a;scrollbars=false;resizable=false;toolbar=false;menubar=false;g_openWindow(page,height,width,win,scrollbars,resizable,toolbar,menubar)}function popUpZoom(url){id=(new Date()).getTime();eval("page"+id+" = window.open(url, '"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=700,left=450,top=150');")}function subscribeNewsletter(b){if(!is_valid_email_address(b.elements.emailAddress.value)){alert("You didn't type in a valid e-mail address (for example: name@domain.com). Please try again.");return false}else{var a=new Ajax(b.action,{method:"post",data:$(b).toQueryString(),onComplete:function(){hidePop("salesAlert");alert("Thank you for signing up!");return true}}).request()}}function subscribeEmail(b){if(!is_valid_email_address(b.elements.sendTo.value)){alert("You didn't type in a valid e-mail address (for example: name@domain.com). Please try again.");return false}else{var a=new Ajax(b.action,{method:"post",data:$(b).toQueryString(),onComplete:function(){hidePop("signUpShow");alert("Thank you for signing up!");return true}}).request()}}function activateField(a){if(a.value==a.defaultValue){a.value=""}};

/* x.js */
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();if(window.opera){var i=xUA.indexOf("opera");if(i!=-1){var v=parseInt(xUA.charAt(i+6));xOp7Up=v>=7;xOp6Dn=v<7}}else{if(navigator.vendor!="KDE"&&document.all&&xUA.indexOf("msie")!=-1){xIE4Up=parseFloat(navigator.appVersion)>=4;xIE4=xUA.indexOf("msie 4")!=-1;xIE5=xUA.indexOf("msie 5")!=-1}else{if(document.layers){xNN4=true}}}xMac=xUA.indexOf("mac")!=-1;function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))){return}eT=eT.toLowerCase();if((!xIE4Up&&!xOp7Up)&&e==window){if(eT=="resize"){window.xPCW=xClientWidth();window.xPCH=xClientHeight();window.xREL=eL;xResizeEvent();return}if(eT=="scroll"){window.xPSL=xScrollLeft();window.xPST=xScrollTop();window.xSEL=eL;xScrollEvent();return}}var eh="e.on"+eT+"=eL";if(e.addEventListener){e.addEventListener(eT,eL,cap)}else{if(e.attachEvent){e.attachEvent("on"+eT,eL)}else{eval(eh)}}}function xGetElementById(a){if(typeof(a)!="string"){return a}if(document.getElementById){a=document.getElementById(a)}else{if(document.all){a=document.all[a]}else{a=null}}return a}function xClientHeight(){var a=0;if(xOp6Dn){a=window.innerHeight}else{if(document.compatMode=="CSS1Compat"&&!window.opera&&document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){a=document.body.clientHeight}else{if(xDef(window.innerWidth,window.innerHeight,document.width)){a=window.innerHeight;if(document.width>window.innerWidth){a-=16}}}}}return a}function xClientWidth(){var a=0;if(xOp6Dn){a=window.innerWidth}else{if(document.compatMode=="CSS1Compat"&&!window.opera&&document.documentElement&&document.documentElement.clientWidth){a=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){a=document.body.clientWidth}else{if(xDef(window.innerWidth,window.innerHeight,document.height)){a=window.innerWidth;if(document.height>window.innerHeight){a-=16}}}}}return a}function xResizeEvent(){if(window.xREL){setTimeout("xResizeEvent()",250)}var a=xClientWidth(),b=xClientHeight();if(window.xPCW!=a||window.xPCH!=b){window.xPCW=a;window.xPCH=b;if(window.xREL){window.xREL()}}}function xScrollEvent(){if(window.xSEL){setTimeout("xScrollEvent()",250)}var a=xScrollLeft(),b=xScrollTop();if(window.xPSL!=a||window.xPST!=b){window.xPSL=a;window.xPST=b;if(window.xSEL){window.xSEL()}}}function xRemoveEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))){return}eT=eT.toLowerCase();if((!xIE4Up&&!xOp7Up)&&e==window){if(eT=="resize"){window.xREL=null;return}if(eT=="scroll"){window.xSEL=null;return}}var eh="e.on"+eT+"=null";if(e.removeEventListener){e.removeEventListener(eT,eL,cap)}else{if(e.detachEvent){e.detachEvent("on"+eT,eL)}else{eval(eh)}}}function xResizeTo(c,a,b){xWidth(c,a);xHeight(c,b)}function xScrollLeft(c,b){var d=0;if(!xDef(c)||b||c==document||c.tagName.toLowerCase()=="html"||c.tagName.toLowerCase()=="body"){var a=window;if(b&&c){a=c}if(a.document.documentElement&&a.document.documentElement.scrollLeft){d=a.document.documentElement.scrollLeft}else{if(a.document.body&&xDef(a.document.body.scrollLeft)){d=a.document.body.scrollLeft}}}else{c=xGetElementById(c);if(c&&xNum(c.scrollLeft)){d=c.scrollLeft}}return d}function xScrollTop(c,b){var d=0;if(!xDef(c)||b||c==document||c.tagName.toLowerCase()=="html"||c.tagName.toLowerCase()=="body"){var a=window;if(b&&c){a=c}if(a.document.documentElement&&a.document.documentElement.scrollTop){d=a.document.documentElement.scrollTop}else{if(a.document.body&&xDef(a.document.body.scrollTop)){d=a.document.body.scrollTop}}}else{c=xGetElementById(c);if(c&&xNum(c.scrollTop)){d=c.scrollTop}}return d}function xDef(){for(var a=0;a<arguments.length;++a){if(typeof(arguments[a])=="undefined"){return false}}return true}function xShow(a){return xVisibility(a,1)}function xHide(a){return xVisibility(a,0)}function xVisibility(b,a){if(!(b=xGetElementById(b))){return null}if(b.style&&xDef(b.style.visibility)){if(xDef(a)){b.style.visibility=a?"visible":"hidden"}return b.style.visibility}return null}function xImgRollSetup(g,d,a){var f,j;for(var c=3;c<arguments.length;++c){j=arguments[c];if(f=xGetElementById(j)){f.xIOU=g+j+a;f.xIOO=new Image();f.xIOO.src=g+j+d+a;f.onmouseout=b;f.onmouseover=h}}function b(k){if(this.xIOU){this.src=this.xIOU}}function h(k){if(this.xIOO&&this.xIOO.complete){this.src=this.xIOO.src}}}function mainNavRolls(){xImgRollSetup("/rugsusa/img/nav2/","_ov",".gif","home","rugs","tap","slip","clock","mirror","light","art","bed","hb")}xAddEventListener(window,"load",mainNavRolls);function showPop(a){e=xGetElementById(a);if(e){xShow(e)}}function hidePop(a){e=xGetElementById(a);if(e){xHide(e)}};

/* popup.js */
function showCatalog(c){var b,a,d;if(window.event){a=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;d=window.event.clientY+document.documentElement.scrollTop+ +document.body.scrollTop}else{a=c.clientX+window.scrollX;d=c.clientY+window.scrollY}document.getElementById("popupForm").style.left=(a-203)+"px";document.getElementById("popupForm").style.top=(d-353)+"px";document.getElementById("popupForm").style.visibility="visible"}function hideCatalog(){document.getElementById("popupForm").style.visibility="hidden"}function showHaveYouSeen(){document.getElementById("popupForm1").style.visibility="visible"}function hideHaveYouSeen(){document.getElementById("popupForm1").style.visibility="hidden"}function showScreen(c,e){var b,a,d;b=document.getElementById(e);if(window.event){a=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;d=window.event.clientY+document.documentElement.scrollTop+ +document.body.scrollTop}else{a=c.clientX+window.scrollX;d=c.clientY+window.scrollY}document.getElementById(e).style.left=(a-10)+"px";document.getElementById(e).style.top=(d+15)+"px";document.getElementById(e).style.visibility="visible"}function hideScreen(a){document.getElementById(a).style.visibility="hidden"};

/* included in all headers */
var typeCheck = new TypeChecker();
