// JavaScript Document
  var ss_screen = "Shopping Cart";
  var ss_sbid = "SSMSB1104863309.27262";
  var ss_ordertotal = "85.63";
  var ss_subtotal = "76.80";
  var ss_taxtotal = "0.00";
  var ss_shiptotal = "8.83";
  var ss_name = new Array;
  var ss_sku = new Array;
  var ss_quantity = new Array;
  var ss_price = new Array;
  var ss_weight = new Array;
  var ss_total_price = new Array;
  var ss_field1 = new Array;
  var ss_field2 = new Array;
  var ss_field3 = new Array;
  var ss_field4 = new Array;
  var ss_field5 = new Array;
  ss_name[0]="3/8\" Kitec XPA, 200 ft Coil";
  ss_sku[0]="011678";
  ss_quantity[0]=1;
  ss_weight[0]=10.00;
  ss_price[0]="76.80";
  ss_total_price[0]="76.80";
  ss_field1[0]="";
  ss_field2[0]="";
  ss_field3[0]="";
  ss_field4[0]="";
  ss_field5[0]="";
  number_products=1;
  number_coupons=0;
var done_flag = 0;

function CheckIt(button, blank_flag) {
  var d = new Date();
  var error = ""; 
  var month = d.getMonth()+1;
  var year  = d.getFullYear();
  var fillin ="Please fill in " ;
  var select_fillin ="Please select a " ;
  var use_cvvs = 0;
  var check_states = 1;
  var cc;
  var digits = "0123456789";
  var select;
  var loop;

//alert(document.billing.First.value + "this is a test ");
 if (button == "68")
   return (true);

  if (done_flag == 1) {
    return (false);
  }
//alert(document.billing.First.value + "this is a test ");

  if (document.billing.First.value == "") 
    error +=  fillin + "First" + "\n";
  if (document.billing.Last.value == "") 
    error +=  fillin + "Last" + "\n";
  if (document.billing.Email.value == "") 
    error +=  fillin + "Email" + "\n";
    // validate the email address
  if (document.billing.Email.value != "")
    if (document.billing.Email.value.indexOf('@',0) == -1 ||
       document.billing.Email.value.indexOf('.',0) == -1)
      error += "Please enter a valid email address of the form yourname@host.com." + "\n";
  if (document.billing.Address.value == "") 
    error +=  fillin + "Address 1" + "\n";
  if (document.billing.City.value == "") 
    error +=  fillin + "City" + "\n";
  if (document.billing.State.value == "n") 
    error +=  select_fillin + "State/Province" + "\n";
  else if (check_states == 1)
    if (document.billing.State.value == "") 
      error +=  fillin + "State/Province" + "\n";
  if (document.billing.Zip.value == "") 
    error +=  fillin + "Zip Code" + "\n";
  if (document.billing.Phone.value == "") 
    error +=  fillin + "Phone Number" + "\n";
  if ((document.billing.usebilling != undefined) &&
        (document.billing.usebilling.checked == false)) { 
    if (document.billing.ShipFirst.value == "") 
      error +=  fillin + "Shipping Address First" + "\n";
    if (document.billing.ShipLast.value == "") 
      error +=  fillin + "Shipping Address Last" + "\n";
    if (document.billing.ShipAddress.value == "") 
      error +=  fillin + "Shipping Address 1" + "\n";
    if (document.billing.ShipCity.value == "") 
      error +=  fillin + "Shipping Address City" + "\n";
    if (document.billing.ShipState.value == "n") 
      error +=  select_fillin + "Shipping Address State/Province" + "\n";
    else if (check_states == 1)
      if (document.billing.ShipState.value == "") 
        error +=  fillin + "Shipping Address State/Province" + "\n";
    if (document.billing.ShipZip.value == "") 
      error +=  fillin + "Shipping Address Zip Code" + "\n";
    if (document.billing.ShipPhone.value == "") 
      error +=  fillin + "Shipping Address Phone Number" + "\n";
  }
cc = document.billing.paytype.value;
if (document.billing.payment.value == "cc" && (cc == 0 || cc ==1 || cc ==2 || cc==3 || cc==10)) {
  if (document.billing.pay1.value == "")  
    error +=  fillin + "Card Number" + "\n";
  else {
    var cc_num = "";
    var cc_x = 0;
    pass_test = 1;
    for (i = 0 ; i < document.billing.pay1.value.length; i++) {
      temp = document.billing.pay1.value.substring(i,i+1);
      if (digits.indexOf(temp) != -1) 
        cc_num += temp;
      else if (temp == "x") 
        cc_x = 1;
    }
    var count = cc_num.length;
    first = cc_num.charAt(0);
    if (cc_x == 1) {
      if (document.billing.paytype.options[document.billing.paytype.selectedIndex].defaultSelected == false) 
        pass_test = 0;
      else
        pass_test = 1;
    }
    else if (cc == 0) {
      if ((first != 4) || ((count != 13) && (count != 16)))
        pass_test = 0;
    }
    else if (cc == 1) {
      temp = cc_num.substring(0,2);
      if ((temp < 51) || (temp > 55) || (count != 16)) 
        pass_test = 0;
    }
    else if (cc == 2) {
      temp = cc_num.substring(0,4);
      if ((temp != 6011) || (count != 16)) 
        pass_test = 0;
    }
    else if (cc == 3) {
      temp = cc_num.substring(0,2);
      if (((temp != 34) && (temp != 37)) || (count != 15)) 
        pass_test = 0;
    }
    else if (cc == 10) {
      temp = cc_num.substring(0,2);
      temp1 = cc_num.substring(0,3);
      if (count != 14)
         pass_test = 0;
      else if (((temp != 36) && (temp != 38))
                         &&
           ((temp1 < 300) || (temp1 > 305)))
         pass_test = 0;
    }
    if (pass_test == 0)
      error +=  "Please enter a valid credit card number." + "\n"; 
  }
  if (use_cvvs > 1) {  
    if (document.billing.cvv2.value == "")  
      error +=  fillin + "Card Verification Value" + "\n";
  }
  if (document.billing.pay2_1.value == "")  
    error +=  fillin + "First Name on Card" + "\n";
  if (document.billing.pay2_2.value == "")  
    error +=  fillin + "Last Name on Card" + "\n";
var expYear = new Number(document.billing.pay4_2.value)+2000;
  if (expYear < year){
	error +=  "Credit Card has expired" + "\n"; 
  }else if (expYear == year){
		if (document.billing.pay4_1.value < month){
        	error +=  "Credit Card has expired" + "\n";
		}
  }
}
if (error.length != 0) {
  alert(error);
  return (false);
} else {
  done_flag = 1;
  return (true);
}
}






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];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_image = newImage("Images/overs/homes.jpg");
		links_image = newImage("Images/overs/links.jpg");
		guest_image = newImage("Images/overs/guest.jpg");
		necklaces_image = newImage("Images/overs/necklaces.jpg");
		bracelets_image = newImage("Images/overs/bracelets.jpg");
		earrings_image = newImage("Images/overs/earrings.jpg");
		range1_image = newImage("Images/overs/range1.jpg");
		range2_image = newImage("Images/overs/range2.jpg");
		preloadFlag = true;
	}
}



	function drawProducts() {	
		if (http_request_price.readyState == 4) {
			if (http_request_price.status == 200) {
			//alert( http_request_price.responseText);
				document.getElementById("pricesheet").innerHTML= http_request_price.responseText;
			} else {
				alert('There was a problem with the request.');
			}
		}
	}
	function drawProductImages() {	
		if (http_request_image.readyState == 4) {
			if (http_request_image.status == 200) {
			//alert( http_request_image.responseText);
				document.getElementById("imageOption").innerHTML= http_request_image.responseText;
			} else {
				alert('There was a problem with the request.');
			}
		}
	}
	
	
	
		function drawOptionImage() {
		//alert(document.catalog.catID.options[document.catalog.catID.selectedIndex].value);
		//alert(document.order.optID.options[document.order.optID.selectedIndex].value);
		var url="";
		http_request_image = false;
	
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request_image = new XMLHttpRequest();
			if (http_request_image.overrideMimeType) {
				http_request_image.overrideMimeType('text/xml');
				// See note below about this line
			}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request_image = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) { 
				try {
					http_request_image = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
	
		if (!http_request_image) {
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}
		
		if(ImageLoad == true){
			url = "http://www./ajax_image_options.php?id=" + document.order.optID.options[document.order.optID.selectedIndex].value + "&retry";
		}
		else{
			url = "http://www./ajax_image_options.php?id=" + document.order.optID.options[document.order.optID.selectedIndex].value;
		}
		http_request_image.onreadystatechange = drawProductImages;
		http_request_image.open('GET', url, true);
		http_request_image.send(null);
		wait = 1;	
   }
   
   
       var http_request_price = false;
	var http_request_image = false;
	var http_request_desc = false;
	var wait = 0;

	function drawOptions(){
		drawOptionDesc();
		drawOptionPricing();
		drawOptionImage();
	}
    function drawOptionPricing() {
		//alert(document.catalog.catID.options[document.catalog.catID.selectedIndex].value);
		var url="";
        http_request_price = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request_price = new XMLHttpRequest();
            if (http_request_price.overrideMimeType) {
                http_request_price.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request_price = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) { 
                try {
                    http_request_price = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request_price) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
		
		url = "http://www./ajax_options.php?id=" + document.order.optID.options[document.order.optID.selectedIndex].value;
		http_request_price.onreadystatechange = drawProducts;
		http_request_price.open('GET', url, true);
        http_request_price.send(null);
		return false;
    }
	
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 	
	
	function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
	{
		reqVer = parseFloat(reqMajorVer + "." + reqRevision);
		// loop backwards through the versions until we find the newest version	
		for (i=25;i>0;i--) {	
			if (isIE && isWin && !isOpera) {
				versionStr = VBGetSwfVer(i);
			} else {
				versionStr = JSGetSwfVer(i);		
			}
			if (versionStr == -1 ) { 
				return false;
			} else if (versionStr != 0) {
				if(isIE && isWin && !isOpera) {
					tempArray         = versionStr.split(" ");
					tempString        = tempArray[1];
					versionArray      = tempString .split(",");				
				} else {
					versionArray      = versionStr.split(".");
				}
				versionMajor      = versionArray[0];
				versionMinor      = versionArray[1];
				versionRevision   = versionArray[2];
				
				versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
				versionNum        = parseFloat(versionString);
				// is the major.revision >= requested major.revision AND the minor version >= requested minor
				if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
					return true;
				} else {
					return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
				}
			}
		}	
	}
		
	function drawMap(https) {
	if(https == "on"){
		var secure=1;
	}else{
		var secure=0;	
	}
		
		var hasProductInstall = DetectFlashVer(6, 0, 65);
		
		// Version check based upon the values entered above in "Globals"
		var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		
		// Location visited after installation is complete if installation is required
		var MMredirectURL = window.location;
		
		// Stored value of document title used by the installation process to close the window that started the installation process
		// This is necessary to remove browser windows that will still be utilizing the older version of the player after installation is complete
		// DO NOT MODIFY THE FOLLOWING TWO LINES
		var MMdoctitle = document.title.slice(0, 47) + " - Flash Player Installation";
		
		// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
		if ( hasProductInstall && !hasReqestedVersion ) {
			var productInstallOETags = '<div style="text-align:center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ 'width="300" height="213"'
			+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			+ '<param name="movie" value="/flash/playerProductInstall.swf?MMredirectURL='+MMredirectURL+'&MMplayerType=ActiveX&MMdoctitle='+MMdoctitle+'" />'
			+ '<param name="quality" value="high" /><param name="bgcolor" value="#000000" />'
			+ '<embed src="/flash/playerProductInstall.swf?MMredirectURL='+MMredirectURL+'&MMplayerType=PlugIn" quality="high" bgcolor="#000000" '
			+ 'width="300" height="213" name="detectiontest" aligh="middle"'
			+ 'play="true"'
			+ 'loop="false"'
			+ 'quality="high"'
			+ 'allowScriptAccess="sameDomain"'
			+ 'type="application/x-shockwave-flash"'
			+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
			+ '<\/embed>'
			+ '<\/object></div>';
			document.write(productInstallOETags);   // embed the Flash Product Installation SWF
		} else if (hasReqestedVersion) {  // if we've detected an acceptable version
			document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http"+ (secure==1?"s":"") +"://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"466\" height=\"284\" id=\"mike_test\" align=\"middle\">" + 
			"<param name=\"allowScriptAccess\" value=\"sameDomain\" />" +
			"<param name=\"movie\" value=\"http://www.okjanitorial.com/flash/map.swf\" />" +
			"<param name=\"quality\" value=\"high\" />" +
			"<param name=\"scale\" value=\"noscale\" />" +
			"<param name=\"allowFullScreen\" value=\"true\" />" + 
			"<param name=\"bgcolor\" value=\"#ffffff\" />" +
			"<embed src=\"http://www.okjanitorial.com/flash/map.swf\" quality=\"high\" scale=\"noscale\" allowfullscreen=\"true\" bgcolor=\"#ffffff\" width=\"466\" height=\"284\" id=\"mike_test\" name=\"mike_test\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>");	
		}  else {  // flash is too old or we can't detect the plugin
			var alternateContent = ''
			+ 'This content requires the Macromedia Flash Player.'
			+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
			document.write(alternateContent);  // insert non-flash content
		  }
	}