//Organic Search Project
//Combined all Javascript for product Page

/////////--- Start of mediaRich.js/////////////////////

/**
* mediaRich.js is used to determine which enlarge window should
* appear to the user for zooming or enlarging. The image size itself
* will determine whether or not the image should be presented in the
* zoom screen or the enlarge screen.
*
* REVISION HISTORY
* ----------------
* Date Created: December 28, 2001
* Author: Ryan O'Brochta/Tallan
*
* @$Revision:   1.0  $
* @$Author:   caesara  $
* @$Date:   Jul 29 2008 19:22:00  $
*
*/
function enlarge(image_name, loc) {
  /**************************************
	 Browser sniffer
	**************************************/
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var NS4 = (document.layers) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var NS6 = (document.getElementById && !document.all) ? true : false;

	/**************************************
	 Browser branching for element selection
	**************************************/
	if (IE4) {
		g_elePrefix = "document.all.";
		g_eleSuffix = "";
  } else if(NS4) {
		g_elePrefix = "document.";
		g_eleSuffix = "";
	} else {
		g_elePrefix = "document.getElementById(\"";
		g_eleSuffix = "\")";
	}
  
  var height, width, pre, post;
  
  // Retrieves the image name from the document.
  var image;
  image = eval(g_elePrefix + "image_enlarge" + g_eleSuffix);
  
  var no_image = "noimage.jpg";
  
  // Determines whether the image exists or not. If their is no
  // image shown, the user is redirected to the product description.
  if (image_name == no_image) {
    if (NS4 || NS6) {
      this.document.URL = "#prod_desc";
    } else {
      this.document.location = "#prod_desc";
    }
    
  // The image exists.
  } else {
    
    var display;
    
    height = image.height;
    width = image.width;
    
    // This image is not zoom capable, thus the user will be displayed the
    // enlarged image in a pop-up window.
    if (height == 167 && width == 149) {
      if (NS4 || NS6) {
        this.document.URL = "#prod_desc";
      } else {
        this.document.location = "#prod_desc";
      }
    } else if (height == 168 && width == 149) {
      display = window.open("/inc/enlarge.asp?pic=" + image_name + "&loc=" + loc, "uBid", "height=480,width=450,toolbar=no,scrollbars=no,menubar=no,titlebar=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      display.focus();
    // The image is capable of being zoomed and the user is displayed
    // a pop-up with zooming capabilities.
    } else {
      display = window.open("/inc/zoom.asp?pic=" + image_name + "&loc=" + loc, "uBid", "height=480,width=450,toolbar=no,scrollbars=no,menubar=no");
      display.focus();
    }
    
    //display.document.close();
  }
}
/////////--- End of mediaRich.js/////////////////////

/////////--- Start of MultiImg.js/////////////////////

/**
* MultiImg.js is used to determine which image should appear in the
* "Product Preview" section of the product page
*
* REVISION HISTORY
* ----------------
* Date Created: October 28, 2002
* Author: Rebecca Barliant
*/

var gMultiViewImageName=String();

function showupdate(NewImgFile, NewImgFileFullPath)
{
	document['bigPhoto'].src = NewImgFileFullPath;
	gMultiViewImageName = NewImgFile;
}

/////////--- End of MultiImg.js/////////////////////

/////////--- Start of ProductPage AddTo Cart/////////////////////


	function checkwar(Which)
	{
	  var setcheck = Which.checked

	  for (i=1; i<3; i++) {
		document.getElementById(i+ "year").checked = false;
	  }

		  if( setcheck )
		  {
			Which.checked = true;
		  }
		  else
		  {
			Which.checked = false;
		  }
	}

	function AddtoCart(link)
	{
		var warranty = "";
		for (i=1; i<3; i++) 
		{
			if (document.getElementById( i + "year").checked)
			{
				warranty =  document.getElementById(i + "year").value;
			}
		}

		link.href = "/Shoppingcart/viewcart.aspx?rca=" + document.getElementById("AUCTIONID").value 
											 + "&rcw=" + warranty 
											 + "&rcq=" + document.getElementById("quantity").value;
		return;
	}
/////////--- End of ProductPage AddTo Cart/////////////////////