// JavaScript Document

/************************************************************
//SEARCH TEXT CHANGE
*/
function clearText(field){
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}

// ************************************************************
//CUSTOM CSS/JS FOR VOLUSION PAGE TYPES

function MyReplaceScript() {}
function AddCss()
{   
   var spos = document.URL.lastIndexOf("/");
   if (spos != -1)
   {
      var pagePart = document.URL.substring(0,spos);
      var dpos = pagePart.lastIndexOf("-");
      if (dpos != -1)
      {
         var v = pagePart.substring(dpos+1);
   
         var cssFile;
         if (v==="p") {
            cssFile = "ProductDetails";
			document.write('<script type="text/javascript" src="/v/vspfiles/templates/christmas/js/template_ProductDetails.js"></script>'); 
			}
         else if (v==="s") {
            cssFile = "SearchResults";
			document.write('<script type="text/javascript" src="/v/vspfiles/templates/christmas/js/template_SearchResults.js"></script>'); 
			}
         else if (v==="a")
            cssFile = "Articles";
 
         document.write('<link rel="stylesheet" href="/v/vspfiles/templates/christmas/css/'+cssFile+'.css" type="text/css">');
      }
   }
}

function AddCss2()
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

	var cssFile2;
	if (sPage === "ProductDetails.asp") {
	   cssFile2 = "ProductDetails";
	   document.write('<script type="text/javascript" src="/v/vspfiles/templates/christmas/js/template_ProductDetails.js"></script>');
	}
	else if (sPage === "ShoppingCart.asp") 
	   cssFile2 = "custom_checkout";
	else if (sPage === "one-page-checkout.asp") 
	   cssFile2 = "custom_checkout";
	else if (sPage === "SearchResults.asp") 
	   cssFile2 = "SearchResults";
	else if (sPage === "PhotoDetails.asp") 
	   cssFile2 = "custom_photodetails";
	else if (sPage === "Receipt.asp") 
	   cssFile2 = "custom_checkout";
	else if (sPage === "orders.asp") 
	   cssFile2 = "custom_checkout";
	else if (sPage === "orderdetails.asp") 
	   cssFile2 = "custom_checkout";

	document.write('<link rel="stylesheet" href="/v/vspfiles/templates/christmas/css/'+cssFile2+'.css" type="text/css">');
}

AddCss();
AddCss2();

// ************************************************************
//FUNCTION USED TO TOGGLE TEXT (SHOW AND HIDE)

function toggle_visibility(id,link_id) {
       var e = document.getElementById(id);
	   var f = document.getElementById(link_id);
       if(e.style.display == 'inline')
	   {
	   e.style.display = 'none';
	   f.style.display = 'inline';
	   }
       else
	   {
          e.style.display = 'inline';
		  f.style.display = 'none';
	   }
    }
