/*
	This code is to allow Javascript to communcted to the Server in order to update it
*/

//
// Define a list of Microsoft XML HTTP ProgIDs.
//
var XMLHTTPREQUEST_MS_PROGIDS = new Array(
  "Msxml2.XMLHTTP.7.0",
  "Msxml2.XMLHTTP.6.0",
  "Msxml2.XMLHTTP.5.0",
  "Msxml2.XMLHTTP.4.0",
  "MSXML2.XMLHTTP.3.0",
  "MSXML2.XMLHTTP",
  "Microsoft.XMLHTTP"
);

//
// Define ready state constants.
//
var XMLHTTPREQUEST_READY_STATE_UNINITIALIZED = 0;
var XMLHTTPREQUEST_READY_STATE_LOADING       = 1;
var XMLHTTPREQUEST_READY_STATE_LOADED        = 2;
var XMLHTTPREQUEST_READY_STATE_INTERACTIVE   = 3;
var XMLHTTPREQUEST_READY_STATE_COMPLETED     = 4;

//
// Returns XMLHttpRequest object. 
//
function getXMLHttpRequest()
{
  var httpRequest = null;

  // Create the appropriate HttpRequest object for the browser.
  if (window.XMLHttpRequest != null)
    httpRequest = new window.XMLHttpRequest();
  else if (window.ActiveXObject != null)
  {
    // Must be IE, find the right ActiveXObject.
    var success = false;
    for (var i = 0;i < XMLHTTPREQUEST_MS_PROGIDS.length && !success;i++)
    {
      try
      {
        httpRequest = new ActiveXObject(XMLHTTPREQUEST_MS_PROGIDS[i]);
        success = true;
      }
      catch (ex)
      {}
    }
  }

  // Display an error if we couldn't create one.
  if (httpRequest == null)
    alert("Error in HttpRequest():\n\n"
      + "Cannot create an XMLHttpRequest object.");

  // Return it.
  return httpRequest;
}

//Adds text to any part of the body of a HTML
function addNode(tagParent,strText,boolAddToBack, boolRemoveNode)
{
  var strNode = document.createTextNode(strText);//holds the test which will be added
     
  //gets the properties of the node
  tagParent = getDocID(tagParent);
  
  //checks if the user whats to replace the node in order to start with a clean slate
  //it also checks if there is a chode node to replace
  if (boolRemoveNode == true && tagParent.childNodes.length > 0)
	//replaces the current node with what the user wants
	tagParent.replaceChild(strNode,tagParent.childNodes[0]);
  else
  {
  	//checks if the user whats to added to the back of the id or the front
  	if(boolAddToBack == true)
		tagParent.appendChild(strNode);
  	else
		//This is a built-in function of Javascript will add text to the beginning of the child
  		insertBefore(strNode,tagParent.firstChild);
  }//end of if else
  
  //returns the divParent in order for the user to use it for more uses
  return tagParent;
}//end of addNode()

//changes the colour of tagTarget to be more dim or removes it
function changeColour(tagTarget)
{
	//gets the properties of tagTarget
	tagTarget = getDocID(tagTarget);

	//checks if there is a tagTarget on the page
	if(tagTarget != null)
	{
		//sets the style to be dim or to remove it
		if(tagTarget.style.opacity == "")
		{
			tagTarget.style.opacity = "0.5";
			tagTarget.style.filter = "alpha(opacity=50)";
		}//end of if
		else
		{
			tagTarget.style.opacity = "";
			tagTarget.style.filter = "";
		}//end of else
	}//end of if
}//end of changeColour()

//changes the image of tagImage to what is in strImageSrc
function changeImage(tagImage,strImageSrc)
{
	//gets the properties of tagImage
	tagImage = getDocID(tagImage);
	
	//checks if there is a properties
	if(tagImage != null)
		tagImage.src = strImageSrc;
}//end of changeImage()

//This is ONLY FOR THIS SITE PLEASE REMOVE
//changes two images are the beginning and end
function changeTwoImages(tagBeginImage,tagEndImage,strBeginImage,strEndImage)
{
	//gets the properties of the tags
	tagBeginImage = getDocID(tagBeginImage);
	tagEndImage = getDocID(tagEndImage);
	
	//checks if there is a tagTarget on the page
	if(tagBeginImage != null && tagEndImage != null)
	{
		//sets the style to be the new iamge
		if(strBeginImage != "" && strEndImage != "")
		{
			tagBeginImage.src = strBeginImage;
			tagEndImage.src = strEndImage;
		}//end of if
	}//end of if
}//end of changeTwoImages()



//This is ONLY FOR THIS SITE PLEASE REMOVE
//changes two images are the beginning and end
function changeImages(tagBeginImage,strBeginImage)
{
	//gets the properties of the tags
	tagBeginImage = getDocID(tagBeginImage);
	//tagEndImage = getDocID(tagEndImage);
	
	//checks if there is a tagTarget on the page
	if(tagBeginImage != null)
	{
		//sets the style to be the new iamge
		if(strBeginImage != "")
		{
			tagBeginImage.src = strBeginImage;
			//tagEndImage.src = strEndImage;
		}//end of if
	}//end of if
}//end of changeTwoImages()







//changes the Text Header and the Image in order for Picture Gallery can display the image fully
function changeImageLightBox(tagImage,tagLightBoxTitle,strImage,strLightBoxTitle,tagTitleBar,strStyleName)
{
	//gets the properties of the tags
	tagImage = getDocID(tagImage);
	tagLightBoxTitle = getDocID(tagLightBoxTitle);
	tagTitleBar = getDocID(tagTitleBar);
	
	//checks if there is a tagTarget on the page
	if(tagImage != null && tagLightBoxTitle != null && tagTitleBar != null)
	{
		//sets the style to be the new iamge
		if(strImage != "")
		{
			var intTitleBarStyle = 0;
			
			tagImage.src = strImage;
			tagLightBoxTitle.innerHTML = strLightBoxTitle;
			
			//checks if the form is IE or the other broswers this is to see if it is need to grow th size to
			//fit the boarder and removes the px at the end of the area
			if (tagTitleBar.currentStyle)
				//IE
				intTitleBarStyle = parseInt(tagTitleBar.currentStyle[strStyleName].substring(0,tagTitleBar.currentStyle[strStyleName].length - 2));
			else
				//other broswers
				intTitleBarStyle = parseInt(document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).substring(0,document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).length - 2));

			//checks if it is need size needs to grow
			if(tagImage.width > intTitleBarStyle)
				tagTitleBar.style.width = (tagImage.width) + "px";
			else
				//removes the style
				tagTitleBar.style.width = '';
		}//end of if
	}//end of if
}//end of changeDymaicLightBox()

//changes the style image in the style for the Background iamge
function changeStyleBackgroundImg(tagTarget, strNewImage)
{
	//gets the properties of tagTarget
	tagTarget = getDocID(tagTarget);

	//checks if there is a tagTarget on the page
	if(tagTarget != null)
	{
		//checks if there is a image to use and sets it
		if(strNewImage != "")
			tagTarget.style.background = "url(" + strNewImage + ")";
	}//end of if
}//end of changeStyleBackgroundImg()

//removes from view all tags in tagContainer with the expection of tagActive
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayer(tagContainer,tagActive,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	
	for(var intIndex = arrTAG.length - 1; intIndex > -1; intIndex--) 
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"";
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"block";
	}//end of for loop
}//end of classToggleLayer()


function classToggleLayer_new(tagContainer,tagActive,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	var arrTAG1 = tagActive.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	//goes around the for each tag that getElementsByTagName found in tagContainter
	
	for(var intIndex = arrTAG.length - 1; intIndex > -1; intIndex--) 
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		
		if(arrTAG[intIndex].id != tagActive.id)
		{
			arrTAG[intIndex].style.display = "none";
		//alert(arrTAG[intIndex].id + " ==== " + tagActive.id + " === " + arrTAG[intIndex].style.display)
		}
		else if (arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "" )
		    arrTAG[intIndex].style.display = "block";
		else if (arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "none")
		    arrTAG[intIndex].style.display = "block";
	}//end of for loop
	
	for(var intIndex1 = arrTAG1.length - 1; intIndex1 > -1; intIndex1--) 
	{
			arrTAG1[intIndex1].style.display = "block";
	
	}
}
//end of classToggleLayer()

//removes from view all tags in tagContainer with the expection of tagActive and adds color if the user choose to
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerColor(tagContainer,tagActive,strClassName,strTAGName,strNonActiveColor,strActiveColor)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
		{
			//if strNonActiveColor is blank then it will remove the style.color
			arrTAG[intIndex].style.color = strNonActiveColor;
		}//end of if
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
		{
			//checks if the user wants to change color of the strTAGName
			if(strActiveColor != "")
				arrTAG[intIndex].style.color = strActiveColor;
		}//end of if else
	}//end of for loop
}//end of classToggleLayerColor()

//Changes the tagActive Class to have the an Select only class so that the tagActive will look different from the rest
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerChangeClass(tagContainer,tagActive,strClassName,strActiveClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1; intIndex--) 
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then adds an strActiveClassName
		if(arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].className = strClassName;
		else if(arrTAG[intIndex].id == tagActive.id)
			arrTAG[intIndex].className = strActiveClassName;
	}//end of for loop
}//end of classToggleLayerChangeClass()

//removes from view all tags in tagContainer with the expection of Image Active and adds the images to the non active image
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerImg(tagContainer,tagActive,strClassName,strTAGName,strActiveImg,strNonActiveImg)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].src = strNonActiveImg;
		else if(arrTAG[intIndex].id == tagActive.id)
			arrTAG[intIndex].src = strActiveImg;
	}//end of for loop
}//end of classToggleLayerImg()

//sets up the basic Links since they are so many of them for Links ONLY
function createLink(tagTD,strLink,strOnClick,strNameTag,strClassName)
{
	//sets the Attributes for the tagA then adds it to the table
	tagA = document.createElement('a');//holds the Linking tag
	tagA.setAttribute('href',strLink);
	if (strClassName != '') tagA.setAttribute('class', strClassName);
	if (strOnClick != '') tagA.setAttribute('onclick',strOnClick);
	tagA.appendChild(document.createTextNode(strNameTag));
	tagTD.appendChild(tagA);
	
	return true;
}//end of createLink()

//decodes str to be a normal string in order to read it
function decodeURL(strDecode)
{
     return unescape(strDecode.replace(/\+/g, " "));
}//end of decodeURL()

//does the display the a message in a on the page weather then an alert
function displayMessage(tagMessage,strMessText,boolAddToBack, boolRemoveNode)
{
	//gets the message properties and sets the text furthermore it does the display
	tagMessage = addNode(tagMessage,strMessText,boolAddToBack, boolRemoveNode);
	tagMessage.style.display = "block";	
	
	return tagMessage;
}//end of displayMessage()

//encodes str to a URL so it can be sent over the URL address
function encodeURL(strEncode)
{
	var strResult = "";
	
	for (intIndex = 0; intIndex < strEncode.length; intIndex++) {
		if (strEncode.charAt(intIndex) == " ") strResult += "+";
		else strResult += strEncode.charAt(intIndex);
	}
	
	return escape(strResult);
}//end of encodeURL()

//gives the user the message has been sent or not and changes the pop area
function endMessage(strEndMessage,strID,tagMessage,tagGrayOut,tagEMailBody)
{
	var tagPopUpArea = getDocID(strID);//holds the pop up area
	var arrActullyEndMassage = strEndMessage.split("</head>");//gets the acrtully end message because ASP.NET has alot of useless overhead
	
	//adds some text to the div tag and then displays it to the user
	displayMessage(tagMessage,arrActullyEndMassage[1],true,true);
	
	//adds in the new line
	tagPopUpArea.appendChild(document.createElement('br'));
	
	//checks if there is the finction was called by the Contact form which does not have a CSS Pop-Up Window
	if (strID != "")
	{
		var tagDIV = document.createElement('div');//holds the DIV tag
		
		//holds the real time div and give its name and align and the link that will close the pop up
		tagDIV.setAttribute('id', "divClose" + strID);
		tagDIV.setAttribute('align', "center");
		tagPopUpArea.appendChild(tagDIV);
	}//end of if
}//end of endMessage()

//gets the document properties in order to use them as there are many types of browers with different versions
function getDocID(tagLayer)
{
	var tagProp = "";//holds the proerties of tagLayer

	//gets the whichLayer Properties depending of the differnt bowers the user is using
	if (document.getElementById)//this is the way the standards work
		tagProp = document.getElementById(tagLayer);
	else if (document.all)//this is the way old msie versions work
		tagProp = document.all[tagLayer];
	else if (document.layers)//this is the way nn4 works
		tagProp = document.layers[tagLayer];
		
	return tagProp;
}//end of getDocID()

//does a group tigger that hides or displays tags
function groupToggleLayer(tagUpperPrice,tagRecommend,tagLine,boolIsShowing)
{
	//gets the properties
	tagUpperPrice = getDocID(tagUpperPrice);
	tagRecommend = getDocID(tagRecommend);
	tagLine = getDocID(tagLine);
	
	if (tagUpperPrice != null && boolIsShowing == false)
		tagUpperPrice.style.display = "none";
	else if(tagUpperPrice != null && boolIsShowing == true)
		tagUpperPrice.style.display = "";
		
	if (tagRecommend != null && boolIsShowing == false)
		tagRecommend.style.display = "none";
	else if(tagUpperPrice != null && boolIsShowing == true)
		tagRecommend.style.display = "";
		
	if (tagLine != null && boolIsShowing == false)
		tagLine.style.display = "none";
	else if(tagUpperPrice != null && boolIsShowing == true)
		tagLine.style.display = "";
}//end of roupToggleLayer()

//Changes the layers of the information section of item detail
function infoDetailLayer(whichLayer,layer1,layer2,layer3)
{
	var activeLayer = "";//holds the active Layer	
	var style2 = "";//holds the style of layer1
	var style3 = "";//holds the style of layer2
	var style4 = "";//holds the style of layer3

	// this is the way the standards work
	if (whichLayer != ''){activeLayer = getDocID(whichLayer);}
	if (layer1 != ''){style2 = getDocID(layer1);}
	if (layer2 != ''){style3 = getDocID(layer2);}
	if (layer3 != ''){style4 = getDocID(layer3);}

	//Checks if there is an active layer
	if (activeLayer != null)
	{
		//checks if the activeLayer is already active and if so then skips code
		//since the layer cannot be turn off and leave a hole in the review layer
		if (activeLayer.style.display == "")
		{
			//removes the block from the display in order to make the layer to disapper	
			if (style2 != '')
				style2.style.display = style2.style.display? "":"";

			//checks if there is a style3
			if (style3 != '')
				style3.style.display = style3.style.display? "":"";
				
			//checks if there is a style3
			if (style4 != '')
				style4.style.display = style4.style.display? "":"";
	
			//displays the new active Layer and updates its id
			activeLayer.style.display = activeLayer.style.display? "":"block";
		}//end of if
	}//end of if
}//end of infoDetailLayer()

//removes all new lines and replaces them with a <br/> html tag
function nl2br(strText)
{
	//checks if there is anything inside strText
	if (strText != "")
	{
 		var re_nlchar = "";//holds the different newlines that the OS uses
		strText = escape(strText);//in codes strText to be more like a URL to find the newlines
			
		//finds the either \r or \n or both since \r is for Linex and Apple and \n is for MS
		if(strText.indexOf('%0D%0A') > -1)
			re_nlchar = /%0D%0A/g ;
		else if(strText.indexOf('%0A') > -1)
			re_nlchar = /%0A/g ;
		else if(strText.indexOf('%0D') > -1)
			re_nlchar = /%0D/g ;
	
		//checks if there is any new lines in strText
		if (re_nlchar != "")
			//changes the strText back to normal with all of the newlines changes to <br/> tag
			return unescape(strText.replace(re_nlchar,'<br />'));
	}//end of if
	
	return strText;
}//end of nl2br()

//set up the form to not be used while sending the message
function preSendEMail(tagMessage,tagEMailBody)
{
	//display to the user their message is beening sent and disables the textbox area
	displayMessage(tagMessage,'Sending Message...',true,true);
	tagEMailBody.style.display = 'none';
}//end of preSendEMail()

//does the search bar onForcus Event
function searchBarForce(tagContainer,strClassName,strTAGName,strColor,strValue)
{
	//gets the search bar properties
	var arrTAG = getDocID(tagContainer).getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer

	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName)
		{
			//changes the color and text to blank when the user frocus on the textbox
		    arrTAG[intIndex].style.color = strColor;
    		arrTAG[intIndex].value = strValue;
		}//end of if
	}//end of for loop
}//end of searchBarForce()

//does the search bar onblur Event(focus off)
function searchBarFocusOff(tagContainer,strClassName,strTAGName)
{
	//gets the search bar properties
	var arrTAG = getDocID(tagContainer).getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer

	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName)
		{
			if(arrTAG[intIndex].value=="")
			{
				//changes the color and text when the user leave the textbox
	    		arrTAG[intIndex].style.color = "#C0c0c0";
   				arrTAG[intIndex].value = " title/series/ISBN/author";
			}//end of if	
		}//end of if
	}//end of for loop
}//end of searchBarFocusOff()

//sends an email to a Friend of the user who ment what a Product
function sendShareEMail(strFileName,tagGrayOut,tagMessage,strPopUpID,tagEMailBody,tagName,tagSendTo,tagEMail,tagComm,strProductName,strProductNameURL)
{		
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var arrSendTo = tagSendTo.value.split(';');//holds all of the e-mail address that are going to be sent out

	//checks if they have a E-Mail
	if (tagSendTo.value=="")
  		{displayMessage(tagMessage,'You must have e-mail address, that you are sending to',true,true);
			return false;}
		
	//goes around each e-mail the user entered
	for(var intIndex = arrSendTo.length - 1; intIndex > -1;intIndex--)
	{
		//checks if there the E-Mail Format is current
		if (strFilter.test(arrSendTo[intIndex]) == false)
  			{displayMessage(tagMessage,"Please input Valid e-mail address for " + arrSendTo[intIndex],true,true);
				return false;}
		else if (arrSendTo[intIndex].match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  			{displayMessage(tagMessage,"The e-mail address, " + arrSendTo[intIndex]  + ", that you are sending to, contains illegal Characters.",true,true);
				return false;}
	}//end of for loop

	//checks if there is a Name
	if (tagName.value=="")
  		{displayMessage(tagMessage,'You must have a name entered',true,true);
			return false;}
				
	//checks if there is E-Mail
	if (tagEMail.value=="")
  		{displayMessage(tagMessage,'You must have e-mail address',true,true);
			return false;}	
			
	//checks if there the E-Mail Format is current
	if (strFilter.test(tagEMail.value) == false)
  		{displayMessage(tagMessage,'Please input valid e-mail address, for yourself!',true,true);
			return false;}
	else if (tagEMail.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  		{displayMessage(tagMessage,'Your e-mail address contains illegal characters.',true,true);
			return false;}
		
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending a e-mail
	preSendEMail(tagMessage,tagEMailBody);
	
	// Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage(htmlJavaServerObject.responseText,strPopUpID,tagMessage,tagGrayOut,tagEMailBody);
							
			//resets the fields and disables the field area
            tagSendTo.value = "";
			tagName.value = "";
			tagEMail.value = "";
			tagComm.value = "";
			
			//means dispapire
			tagEMailBody.style.display = "";
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('<head></head>Unable to Connect to the Server.</head>',strPopUpID,tagMessage,tagGrayOut,tagEMailBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtName=" + encodeURL(tagName.value) + "&txtFromEMail=" + encodeURL(tagEMail.value) + "&txtComm=" + encodeURL(nl2br(tagComm.value)) + "&txtSendTo=" + encodeURL(tagSendTo.value) + "&ProductName=" + encodeURL(strProductName) + "&ProductNameURL=" + encodeURL(strProductNameURL));
			
	return true;
}//end of sendShareEMail()

//starts up the page
function startUp()
{
	var oldonload=window.onload;//holds any prevs onload function from the js file

	//gets the onload window event checks if there is a function that is already in there
	window.onload=function(){
		if(typeof(oldonload)=='function')
			oldonload();
											
		//finds which browser the user is using for Firefox it is the defult
		//for IE 
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			//checks if IE is 7 as IE 8 is more standards compliated

			if(navigator.appVersion.indexOf('MSIE 7') != -1)
			{
				//Home Page
				
				var tagTorontoDivHigh = getDocID('divTorontoDivHigh');//holds Toronto Nav Divider
				var tagHomeDivHigh = getDocID('divHomeDivHigh');//holds Interntal Nav Divider
				var tagWelcomeTabHeader = getDocID('divWelcomeTabHeader');//holds Welcome Tab Body
							
				//checks if there is a divWelcomeTabHeader
				if(tagWelcomeTabHeader != null)
				{
					tagWelcomeTabHeader.style.marginBottom = "-3px";
				}//end of if
				
				//checks if there is a divHomeDivHigh
				if(tagHomeDivHigh != null)
				{
					tagHomeDivHigh.style.margin = "0px";
					tagHomeDivHigh.style.marginRight = "350px";
					tagHomeDivHigh.style.right = "-1px";
					tagHomeDivHigh.style.display = "none";
				}//end of if
				
				//checks if there is a divTorontoDivHigh
				if(tagTorontoDivHigh != null)
				{
					tagTorontoDivHigh.style.margin = "0px";
					tagTorontoDivHigh.style.marginRight = "350px";
					tagTorontoDivHigh.style.right = "-1px";
					tagTorontoDivHigh.style.display = "none";
				}//end of if
				
				//TOMGirlls
				
				var tagTomGirlsHeaderText = getDocID('divTomGirlsHeaderText');//holds divTomGirlsHeaderText Hidden
				
				//checks if there is a divTomGirlsHeaderText 
				if(tagTomGirlsHeaderText != null)
				{
					tagTomGirlsHeaderText.style.marginRight = "0px";
					//tagTomGirlsHeaderText.style.right = "-1px";
				}//end of if
				
				var tagMediaZoneDiv = getDocID('mediaZoneDiv');
				if(tagMediaZoneDiv != null){
					tagMediaZoneDiv.style.marginTop='85px'; 
					tagMediaZoneDiv.style.position = 'absolute';
					// width:200px;"
				}
			}//end of if
		}//end of if
		//for Safari and Mac
		else if (navigator.userAgent.indexOf('Safari') !=-1 || navigator.platform.indexOf("Mac") > -1)
		{
		var tagMediaZoneDiv = getDocID('mediaZoneDiv');
		    if(tagMediaZoneDiv != null){
		        tagMediaZoneDiv.style.marginTop='105px'; 
		        tagMediaZoneDiv.style.position = 'absolute';
		        // width:200px;"
		    }
		}//end of if else
		//for firefox
		else if (navigator.userAgent.indexOf('Firefox') !=-1)
		{
		    var tagMediaZoneDiv = getDocID('mediaZoneDiv');
		    if(tagMediaZoneDiv != null){
		        tagMediaZoneDiv.style.marginTop='105px'; 
		        tagMediaZoneDiv.style.position = 'absolute';
		        // width:200px;"
		    }
		}//end of if else
		//for Opera
		else if (navigator.userAgent.indexOf('Opera') !=-1)
		{
		}//end of if else		
	}//end of window.onload=function()
}//end of startUp()

//shoes and hides a <div> using display:block/none from the CSS
function toggleLayer(tagLayer,tagGrayOut,tagMedia)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	tagGrayOut = getDocID(tagGrayOut);
	tagMedia = getDocID(tagMedia);
	
	if (tagStyle != null){tagStyle.style.display = tagStyle.style.display? "":"block";}
	if (tagGrayOut != null)
	{
		tagGrayOut.style.display = tagGrayOut.style.display? "":"block";

		//for IE
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			tagGrayOut.attachEvent('onclick',function () {
				//specal case pleace remove when REUSING THIS FUNCTION UNLESS YOU ARE USING IT Email TO A FRIEND
				infoDetailLayer('divShareFriendsBody','divShareMessage','','');

				toggleLayer(tagStyle.id,tagGrayOut.id)
			});
		}//end of if
		//for the other browsers
		else
		{
			tagGrayOut.addEventListener('click',function () {
				//specal case pleace remove when REUSING THIS FUNCTION UNLESS YOU ARE USING IT Email TO A FRIEND
				infoDetailLayer('divShareFriendsBody','divShareMessage','','');

				toggleLayer(tagStyle.id,tagGrayOut.id);
			},false);
		}//end of else
	}//end of if
}//end of toggleLayer()

//shoes and hides a <div> using display:block/none from the CSS
function toggleLayerDisplayNone(tagLayer)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	
	if (tagStyle != null){tagStyle.style.display = "none";}
}//end of toggleLayer()

//shoes and hides a <div> using display:block/none from the CSS and stops the media for IE
function toggleLayerMedia(tagLayer,tagGrayOutt,tagMedia)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	tagGrayOut = getDocID(tagGrayOutt);
	tagMedia = getDocID(tagMedia);
		
	if (tagStyle != null)
	{tagStyle.style.display = tagStyle.style.display? "":"block";}
	
	if (tagGrayOut != null)
	{
		tagGrayOut.style.display = tagGrayOut.style.display? "":"block";

		//for IE
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			tagGrayOut.attachEvent('onclick',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id)
				
				//checks if there is any Media to stop also pleace remove when REUSING THIS FUNCTION 
				if (tagMedia != null)
					tagMedia.Stop();
			});
		}//end of if
		//for the other browsers
		else
		{
			    tagGrayOut.addEventListener('click',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id);
			},false);
		}//end of else
	}//end of if
}//end of toggleLayer()



/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/
function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

function setupCurrentName(newName){
    var lbNow = document.getElementById('lblNowPlaying');
    if(lbNow!=null)
        lbNow.innerText = 'Now playing: ' + newName;
}

function reloadVideo(videoObject,titleTxt,item,strVideoFile,strMovieTitle, strMainHolder)
{	
	//sets the default if there is no strVideo or strMovie
	if(strVideoFile == null)
		strVideoFile = "videoFilePH";
	
	if(strMovieTitle == null)
		strMovieTitle = "movieTitle";
		
	if(strMainHolder == null)
		strMainHolder = "divTOMGirlsMovie";
	
    var resultHolder = getDocID(strVideoFile);
    if(resultHolder != null){			
	    resultHolder.innerHTML = videoObject;
	    
	}
	var title = getDocID(strMovieTitle);
	if(title != null){
	    title.innerHTML = titleTxt;
	 }
    var mainHolder = getDocID(strMainHolder);
    if(mainHolder != null){
		if(strVideoFile == "videoFilePH")
	    	mainHolder.style.top = parseInt(item)*200 + 280 + 'px';
	    
		mainHolder.style.position = 'absolute';
	}
}


function reloadVideo2(videoObject)
{	
	
    var resultHolder = getDocID('videoFilePH');
    if(resultHolder != null){			
	    resultHolder.innerHTML = videoObject;
	    
	}
}

function removeVideo2()
{	

    var resultHolder = getDocID('videoFilePH');
    if(resultHolder != null){			
	    resultHolder.innerHTML = '';
	}
}


var XmlHttp;
var ErrMsg = 'There was a problem retrieving data from the server.';
var linksHolderObj = null;

function reloadLinks(catId, prodId)
{
    try{
	    var requestUrl = 'AddLinks.ashx?productId=' + prodId;
	    requestUrl += '&categoryId=' + catId;
    	
	    CreateXmlHttp();
	    if(XmlHttp)
	    {
		    XmlHttp.onreadystatechange = HandleUpdateLinksResponse;
		    XmlHttp.open("GET", requestUrl, true);
		    XmlHttp.send(null);
	    }	
	}
	catch(e){
	    alert(e);
	}
}

function CreateXmlHttp()
{
	// IE
	try
	{
		XmlHttp = new ActioveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(os)
		{
			XmlHttp = null;
		}
	}
	// Mozilla and Safari	
	if(!XmlHttp && typeof XMLHttpRequest != "undefined")
	{
		XmlHttp = new XMLHttpRequest();
	}
}

function HandleUpdateLinksResponse()
{
	if(XmlHttp.readyState == 4)
	{
		if(XmlHttp.status == 200)
		{
			setupLinks(XmlHttp.responseText);		
		}
		else
		{
			alert(ErrMsg);
		}
	}
}

function setupLinks(resultDoc)
{	
	if(resultDoc != null)
	{
		try
		{
			var resultHolder = getDocID('divLinks');
            if(resultHolder != null){			
			    resultHolder.innerHTML = resultDoc;
			}
		}
		catch(e)
		{
			window.alert(ErrMsg);
		}
	}
	else
	{
		window.alert(ErrMsg);
	}
}


function removeVideo(strVideoFile)
{	
	if(strVideoFile == null)
		strVideoFile = "videoFilePH";

    var resultHolder = getDocID(strVideoFile);
    if(resultHolder != null){			
	    resultHolder.innerHTML = '';
	}
	var lbNow = document.getElementById('lblNowPlaying');
    if(lbNow!=null)
        lbNow.innerHTML = '';
        
    var lnks = getDocID('divLinks');
    if(lnks!=null)
        lnks.innerHTML = '';
}

function toggleLayerMedia2(tagLayer,tagGrayOutt,tagMedia)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	tagGrayOut = getDocID(tagGrayOutt);
	tagMedia = getDocID(tagMedia);
		
	if (tagStyle != null)
	{tagStyle.style.display = tagStyle.style.display? "":"block";}
	
	if (tagGrayOut != null)
	{
		tagGrayOut.style.display = tagGrayOut.style.display? "":"block";

		//for IE
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			tagGrayOut.attachEvent('onclick',function () {
			    removeVideo();
				toggleLayer(tagStyle.id,tagGrayOut.id)
				
				//checks if there is any Media to stop also pleace remove when REUSING THIS FUNCTION 
				if (tagMedia != null)
					tagMedia.Stop();
			});
		}//end of if
		//for the other browsers
		else
		{
			    tagGrayOut.addEventListener('click',function () {
			    removeVideo();//
				toggleLayer(tagStyle.id,tagGrayOut.id);
			},false);
		}//end of else
	}//end of if
}//end of toggleLayer()



