<!--
function FP_changeProp() {//v1.0
 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
 d.$cpe=new Array(); 
 if(o) for(i=2; i<args.length; i+=2){ 
	v=args[i+1]; s="o"; 
	ao=args[i].split("."); 
	for(j=0; j<ao.length; j++){ 
		s+="."+ao[j]; 
		if(null==eval(s)){ 
		s=null; break; 
		} 
	} 
	x=new Object; 
	x.o=o; 
	x.n=new Array(); 
	x.v=new Array();
	x.n[x.n.length]=s; 
	eval("x.v[x.v.length]="+s); 
	d.$cpe[d.$cpe.length]=x;
 if(s) eval(s+"=v"); 
 }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; 
 if(!o)o=document; 
 if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; 
 else if(o.all) el=o.all[id]; 
 
 if(el) return el;
 if(o.id==id || o.name==id) 
 return o; 
 
 if(o.childNodes) c=o.childNodes; 
 if(c) for(n=0; n<c.length; n++) { 
	el=FP_getObjectByID(id,c[n]); 
	if(el) return el; 
 }
 f=o.forms; 
if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_changePropRestore() {//v1.0
 var d=document,x; if(d.$cpe) { for(i=0; i<d.$cpe.length; i++) { x=d.$cpe[i];
 if(x.v=="") x.v=""; eval("x."+x.n+"=x.v"); } d.$cpe=null; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 
  doc.$imgSwaps=null; }
}

function displayPopup(url, height, width) {
  properties = "print=0,toolbar=0,location=0,resizable=1,scrollbars=1,height=" + height;
  properties = properties + ",width=" + width;
  properties = properties + ",left=0,top=0";
  popupHandle = open(url, "tipwindow", properties);
}

function displayFixedPopup(url, height, width){
  properties = "print=0,toolbar=0,location=0,resizable=0,scrollbars=0,height=" + height;
  properties = properties + ",width=" + width;
  properties = properties + ",left=0,top=0";
  popupHandle = open(url, "tipwindow", properties);
}

function closeWindow() {
	popupHandle=window.close()
} 

function imgSwitch(strImage, strArrow, ColorRef){

var colorNameParts=document.forms.myNewColorForm.myNewColor.value;
var myPieces=colorNameParts.split(",")

	document.imgMain.src = "../" + myPieces[0];
	document.anchors("imgLink").href = "javascript:displayPopup('preview_image.asp?Id=" + myPieces[2] +"',480,640)";
	document.anchors("imgLink2").href = "javascript:displayPopup('preview_image.asp?Id=" + myPieces[2] +"',480,640)";
	document.anchors("favLink").href = "../favorites/my_favorites.asp?Style=76882&Color=" + myPieces[2];
	document.anchors("mailLink").href = "javascript:displayPopup('../email_templates/send_by_email.asp?Color=" + myPieces[2] +"',400,400)";
	
}
function checkpulldown(){
	if (myNewColorForm.PN.selectedIndex == 0){
		if (myNewColorForm.PadNo.selectedIndex != 0){
			//var strFreePad;
			//var iLen = String(myNewColorForm.PadNo[myNewColorForm.PadNo.selectedIndex].value).length;
            //alert(String(myNewColorForm.PadNo[myNewColorForm.PadNo.selectedIndex].value).substring(iLen, iLen - n));
			if (document.myNewColorForm.FreePad1.value == 'free') {
				//strFreePad = Right(myNewColorForm.PadNo[myNewColorForm.PadNo.selectedIndex].value, 8);

				alert("Please select a rug size.");
				//var freePad = 'add $0'
			
			return (false);
			}
		}
		if (myNewColorForm.PadNo.selectedIndex == 0){
			alert("Please select a rug or pad size.");
			myNewColorForm.PN.focus();
			return (false);
		}
	}
}

function Right(str, n)
/***
        IN: str - the string we are RIGHTing
            n - the number of characters we want to return

        RETVAL: n characters from the right side of the string
***/
{
        if (n <= 0)     // Invalid bound, return blank string
            return "";
        else if (n > String(str).length)   // Invalid bound, return
            return str;                     // entire string
        else { // Valid bound, return appropriate substring
            var iLen = String(str).length;
            return String(str).substring(iLen, iLen - n);
        }
}
// -->