<!---

	//
	//
	//
	///////////////////////////////////////////////////
	function showPhoto(photo){
		photolink=document.getElementById(photo).href;
		//alert(photolink);
		tb_open_new(photolink+'&height=500&width=600');		

	}


	//
	//
	//
	///////////////////////////////////////////////////
	function isdefined(variable)
	{
	    return (typeof(window[variable]) == "undefined")?  false: true;
	}

	//
	//
	//
	///////////////////////////////////////////////////
    function makeRequest(url) {

        var http_request = false;

        //alert(url);

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);
        
        //return alertContents(http_request);;

    }

	//
	//
	//
	///////////////////////////////////////////////////
    function alertContents(http_request) {
        //alert(http_request.readyState);
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
               //alert("Text "+http_request.responseText);

//               var returnedXML = http_request.responseXML.getElementsByTagName("total");
              
                //The node value will give you actual data
//               var sTotal = returnedXML[0].nodeValue; 
               var sTotal = http_request.responseText.split(":")[0];
              // alert("Total "+sTotal);
               
               if ((document.CartForm) && (typeof document.CartForm.Subtotal != "undefined")){
//               if (isdefined(document.CartForm.Subtotal)) {
               	document.CartForm.Subtotal.value = sTotal;
	             //  alert("SubTotal "+document.CartForm.Subtotal.value);
               }

               var sDiscount = http_request.responseText.split(":")[1];
//               alert("Discount "+sDiscount);
               if ((document.CartForm) && (typeof document.CartForm.Discount != "undefined")){
//               if (isdefined(document.CartForm.Discount)) {
                  document.CartForm.Discount.value = sDiscount;
                  }
               
            } else {
                alert('There was a problem with the request.'+http_request.status);
            }
        }

    }




function removeProduct(id) {
   removeURL = "/order/removeitem.php?ID="+id;
   makeRequest(removeURL);
   toggleItem(id);
}

function removeWish(id) {
   removeURL = "/order/removewish.php?ID="+id;
   makeRequest(removeURL);
   toggleItem(id);
}


function plusProduct(id) {
   var qtyField = eval("document.CartForm." + id + "qty");
   qtyField.value = Number(qtyField.value)+1;
   //alert(qtyField.value)
   scriptURL = "/order/plusitem.php?ID="+id;
   makeRequest(scriptURL);
}

function minusProduct(id){
   var qtyField = eval("document.CartForm."+id+"qty");
   //alert(qtyField.value)
   if (qtyField.value == '1') {
   	alert('Please use the X button to remove items from your cart.');
   	return;
   }
   qtyField.value = Number(qtyField.value)-1;
  // if (qtyField.value == "0") {
  // qtyField.value = "1"
  // 	}
   scriptURL = "/order/minusitem.php?ID="+id;
   makeRequest(scriptURL);
}

function addProduct(id,title,price,quantity,cid,pcount,store) {
   scriptURL = "/order/ajaxadditem.php?ID="+id+"&TITLE="+title+"&PRICE="+price+"&QTY="+quantity+"&CID="+cid+"&PCOUNT="+pcount+"&STORE="+store;
   makeRequest(scriptURL);
}

function addToWish(id,title,price,quantity,cid,pcount,store) {
//   alert('Adding to wish list');
   scriptURL = "/order/ajaxaddwish.php?ID="+id+"&TITLE="+title+"&PRICE="+price+"&QTY="+quantity+"&CID="+cid+"&PCOUNT="+pcount+"&STORE="+store;
   makeRequest(scriptURL);
}


function toggleItem(id) {
  var obj = null;
  if (  (document.getElementById && (obj = document.getElementById(id)))
     || (document.all && (obj = document.all[ id ]))) {
    obj.style.visibility = "hidden";
    obj.style.display = "none";
    obj.style.overflow = "hidden" ;
//    obj.style.clip = "auto";
    obj.style.height = "0";
    }
  else if (document.layers && (obj = document.layers[id])) {
    obj.visibility = "hide";
    obj.style.display = "none";
    obj.style.overflow = "hidden" ;
   obj.style.clip = "auto";
    obj.style.height = "0";
   }


}

  function notice () {
      noticeWindow = window.open('/shipinst.html', 'noticeWin',
                       'Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=350,height=200')
      noticeWindow.focus();
      }

  function openCart () {
      return true;
      shopcart=window.open('', 'shopcart', 'Toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=1,width=316,height=270')
      shopcart.focus();
     }

  function privacyNotice () {
      shopcart=window.open('/emailprivacy.html', 'shopcart', 'Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=316,height=270')
      shopcart.focus();
     }

   function ratings () {
     noticeWindow = window.open('/ratings.html', 'noticeWin', 'Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=350,height=200')
     noticeWindow.focus();
     }


  function openImage () {
      if (document.images) {
         imagewin=window.open('', 'images', 'Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,width=600,height=480')
         imagewin.focus();
         }
     }


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			//alert(" Changing " + document[changeImages.arguments[i]].src);
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		faqImage = newImage("/images/faq-on-gif.gif");
		bagImage = newImage("/images/checkout-on-gif.gif");
		signoutImage = newImage("/images/signout-on-gif.gif");
		radtvImage = newImage("/images/radtv-on-gif.gif");
		logout = newImage("/images/logout-on-gif.gif");
		myaccount = newImage("/images/myaccount-on-gif.gif");
		preloadFlag = true;
	}
}


function setCookie (name, value) {
  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires)) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}


function WishList(form_name) {
  document.form_name.submit();
}


// --->