<!-- Hide script from old browsers

function pop(newwin,twidth,theight) {
	//alert(newwin);
	if (typeof twidth == 'undefined') {twidth=640;}
	if (typeof theight == 'undefined') {theight=500;}
	flyout=window.open(newwin,"flyout","resizable=yes,scrollbars=yes,width="+twidth+",height="+theight+",top=0,left=0,toolbar=no,status=no,menubar=no");
	if (window.focus) {flyout.focus();}
	if (!flyout.opener) {
		flyout.opener = self;
	}
}
function popwish(newwin) {flyout=window.open(newwin,"colorflyout","resizable=yes,scrollbars=yes,width=400,height=250,top=0,left=0,toolbar=no,status=no,menubar=no");if (!flyout.opener) flyout.opener = self;}
function popEmail(newwin,w) {flyout=window.open(newwin,"flyout","resizable=yes,scrollbars=yes,width=400,height=300,top=0,left=0,toolbar=no,status=no,menubar=no")}

//functions for netflame
function getCookie(name){
	var cookies=document.cookie;
	var start=cookies.indexOf(name+'=');
	if (start<0)
		return null;
	var end=cookies.indexOf(';',start);
	if (end<0)
		end=cookies.length;	
	return cookies.substring(start+name.length+1,end);
}
function fc_modify(url) {
	if (typeof(fcPref)=='undefined' || !fcPref)
		return url;
	var fcCCookie = getCookie("fcC");
	if (fcCCookie) {
		url += ((url.indexOf('?')>0) ? '&' : '?') + "fcC="+escape(fcCCookie);
	}
	return url;
}
function fc_submit(form) {
	if (form && form.action)
		form.action = fc_modify(form.action);
	return true;
}
function fc_click(lnk) {
	if (lnk && lnk.href) {
		var url = fc_modify(lnk.href);
		document.location.href=url;
	}
	return false;
}

// for windows, but it's generic
function getFormIndex(n) {
	for (var i = 0; i < n.form.elements.length; i++) {
		if(n == n.form.elements[i]) {
			return i;
		}
	}
	return -1;
}

//window calculate total functions
function getCheckedWindowOptions(form) {
	var total = 0;
	var totalPrice = 0;
	//alert(form);
	var max = form.ckbox.length;
	for (var idx = 0; idx < max; idx++) {
		if (eval("document."+ form.name +".ckbox[" + idx + "].checked") == true) {
			total += 1;
			totalPrice += parseInt(eval("document."+ form.name +".ckbox[" + idx + "].value"));
		}
	}
	eval("document." + form.name + ".addOnPrice.value=totalPrice");
}

function setBasePrice(item,amount) {
	if (isNaN(amount)) { amount = "'Choose A Color'";}
	//alert(typeof(opener.document.getElementById));
	if (typeof(opener.document.getElementById) == "undefined") {
		eval("opener.document.compare.basePrice"+item+".value="+amount);
		eval("opener.document.compare.basePriceShow"+item+".value="+amount);
	}
	
	else {
		amount=toDollarsAndCents(amount);
		eval("opener.document.getElementById('priceDivform"+item+"').innerHTML='$"+amount+"'");
		eval("opener.document.compare.basePrice"+item+".value="+amount);
		
	}
	//alert(opener.document.compare);
	getCompareTotal(opener.document.compare,item);
}

function getTotal(form) {
	getCheckedWindowOptions(form);
	addOnPrice = parseInt(eval("document."+ form.name +".addOnPrice.value"));
	basePrice = parseInt(eval("document."+ form.name +".basePrice.value"));
	totalPrice = addOnPrice+basePrice;
	if (isNaN(totalPrice)) { totalPrice = "Choose A Color";}
	if (typeof(document.getElementById) == "undefined") {
		eval("document." + form.name + ".totalPrice.value=totalPrice");
	}
	else {
		if (!(eval("document.getElementById('priceDiv" + form.name + "').innerHTML=totalPrice") )) {
			eval("document." + form.name + ".totalPrice.value=totalPrice");
		}
	}
}


function toDollarsAndCents(n) {
  var s = "" + Math.round(n * 100) / 100
  var i = s.indexOf('.')
  if (i < 0) return s + ".00"
  var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3)
  if (i + 2 == s.length) t += "0"
  return t
}

function verifyQuickOrder(f){ 
		var pattern=/quantity/;
		var num='0';
		var qCheck=true;
		var tmpCheck=false;
		for (var i=0;i<f.length;i++) {
			var e=f.elements[i]; 
			if (pattern.test(e.name)==true){ 
					//alert(e.value);
					curNum = e.name.substr(0,1);
					if (curNum != num) {
						num=curNum;
						if (qCheck==true){qCheck=tmpCheck;}
						tmpCheck=false;					
					}
					if ((e.value!='') && (!isNaN(e.value))) {
						//alert(e.value);
						if (e.value!=0){
							tmpCheck=true;
						}
					}	
			}
		}
		if ((qCheck==true)&&(tmpCheck==false)){qCheck=tmpCheck;}
		if (qCheck==false){alert('Invalid Quantity. Please make sure at least one quantity box is filled for each item.');}
		return qCheck;
	}
	
function changeImage(imgName,imgSrc) {
	//used for quick order in clsItem
	document[imgName].src=imgSrc;
	}
	
function addEmails() {
//used in wishlist to add email address to the sendTo box of the send wishlist form
	if(opener.document.sendEmail.sendTo.value == "name@name.com; anotherfriend@name.com;"){
		opener.document.sendEmail.sendTo.value = "";
	}
	if(document.chooseList.email.length > 0 ){
		for (var i=0;i<document.chooseList.email.length;i++) {
			if (document.chooseList.email[i].checked == true) {
				//alert(document.chooseList.email[i].value);
				opener.document.sendEmail.sendTo.value += document.chooseList.email[i].value +'; ';
			}
		}
	}
	else {
		if (document.chooseList.email.checked == true) {
				//alert(document.chooseList.email[i].value);
				opener.document.sendEmail.sendTo.value += document.chooseList.email.value +'; ';
		}
	}
	//return false;
}

function toggle(id) {
  if (document.all){
    if(document.all[id].style.display == 'none'){
      document.all[id].style.display = '';
    } else {
      document.all[id].style.display = 'none';
    }
  } else if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';
    }
  } else if(document.layers) {
      if(parseInt(id + 1)){
	  ditem = id + 1;
      } else {
	  ditem = document.menu.hirelist.names[id];
      }
      if(document.menu.hirelist.expandos[ditem].clip.bottom == 0) {
	     document.menu.hirelist.expandos[ditem].clip.bottom = document.menu.hirelist.heights[ditem];
      } else {
	  document.menu.hirelist.expandos[ditem].clip.bottom = 0;
      }
      align();
  }
}

/***********
 *function that sets radio button of a certain value
 *used in windows buildOptions2 when a drop down box is changed
 */
function setRadioButton(radioGroup, selValue){
  for (i = 0; i < radioGroup.length; i++){
    if (radioGroup[i].value == selValue){
      radioGroup[i].checked = true;
    }
  } 
}
/***********
 *function that gets the values of the first order form and saves the window
 */
function saveWindow(){
    var item=document.getElementById('item').value;
    var colorInv2=document.getElementById('colorInv2').value;
    var color=document.getElementById('color').value;
    var width=document.getElementById('width').value;
    var width_fraction=document.getElementById('width_fraction').value;
    var height=document.getElementById('height').value;
    var height_fraction=document.getElementById('height_fraction').value;
    var room=document.getElementById('room').value;
    var mount=document.getElementById('mount').value;

    pop('winpop.php?item='+item+'&colorInv2='+colorInv2+'&color='+color+'&width='+width+'&width_fraction='+width_fraction+'&height='+height+'&height_fraction='+height_fraction+'&room='+room+'&mount='+mount+'&saved=addwindowQS',540,330);
}
// End the hiding -->