<!--

function myOnSubmitEventHandler() {
		try {
			if(typeof(document.getElementById('editor1').EscapeUnicode) == 'undefined') {
				throw "Error"
			} else {
				document.getElementById('editor1').EscapeUnicode = true;
				document.getElementById('xhtml1').value = document.getElementById('editor1').value;
			}			
		}
		catch(er) {
			document.getElementById('xhtml1').value = document.getElementById('alternate1').value;
		}
	}
	

function moveup(uSel) {
   var intNewValue;
   var strNewText;
	for (i=1;i<uSel.options.length;i++)
		if (uSel.options[i].selected)
		{
		   intNewText = uSel.options[i-1].text;
		   intNewValue = uSel.options[i-1].value;
		   uSel.options[i-1].text = uSel.options[i].text;
		   uSel.options[i-1].value = uSel.options[i].value;
		   uSel.options[i].text = intNewText;
		   uSel.options[i].value = intNewValue;
		   uSel.options[i].selected = false;    
		   uSel.options[i-1].selected = true;    
		}
		
}
function movedown(uSel) {
   var intNewValue;
   var strNewText;
	for (i=uSel.options.length - 2;i>=0;i--)
		if (uSel.options[i].selected)
		{
		   intNewText = uSel.options[i+1].text;
		   intNewValue = uSel.options[i+1].value;
		   uSel.options[i+1].text = uSel.options[i].text;
		   uSel.options[i+1].value = uSel.options[i].value;
		   uSel.options[i].text = intNewText;
		   uSel.options[i].value = intNewValue;
		   uSel.options[i].selected = false;    
		   uSel.options[i+1].selected = true;    
		   
		}
}	

function submitform(uSel,uTxt) {
    var strSubmitString
    strSubmitString = "";
  	for (i=0;i<uSel.options.length;i++)
  	    {
  		if (i == 0) {
  	       strSubmitString = uSel.options[i].value
           }
           else
           {
  	       strSubmitString = strSubmitString + "|" + uSel.options[i].value
           }
        }     
       uTxt.value = strSubmitString; 		   	    
}

function ImageLoadFailed() {
  window.event.srcElement.style.display = "None";
}


/*

addRemoveClass:

check if there is already a class applied and add the new one preceeded by a space if that is the case:
a - defines the action you want the function to perform.
o - the object in question.
c1 - the name of the first class
c2 - the name of the second class

Possible actions are:

swap - replaces class c1 with class c2 in object o.
add - adds class c1 to the object o.
remove - removes class c1 from the object o.
check - test if class c1 is already applied to object o and returns true or false. 

*/

function addRemoveClass(a,o,c1,c2)
{
  switch (a){
    case 'swap':
      o.className=!addRemoveClass('check',o,c1)?o.className.replace(c2,c1): o.className.replace(c1,c2);
    break;
    case 'add':
      if(!addRemoveClass('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}

function findParent(elementID){
	var childElement = document.getElementById(elementID);
	for (var i=0; i<document.forms.length; i++) { 
		for (var x=0; x<document.forms[i].elements.length; x++) {
			alert(childElement.parentNode.id);
			if(childElement.id == elementID){
				return document.forms[i].id;
			}
		}
	} 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var str = new String(features);
	var hStartPos, hEndPos, hVal 
	var wStartPos, wEndPos, wVal	
	var x, y
	
	if((str.indexOf("height") >= 0)&&(str.indexOf("width") >= 0)) {
		hStartPos = str.indexOf("height");	
		hEndPos = str.indexOf(",", hStartPos);
		hVal = str.substring(hStartPos + 7, hEndPos);
	
		wStartPos = str.indexOf("width");	
		wEndPos = str.indexOf(",", wStartPos);
		wVal = str.substring(wStartPos + 6, wEndPos);
	
		x = (screen.availWidth / 2) - (wVal / 2)
		y = (screen.availHeight / 2) - (hVal / 2)
		
		var newWin = window.open(theURL,winName,features);
		newWin.moveTo(x, y);
	}
	else {
		window.open(theURL,winName,features);
	}
}

function changeDate(newDate) {
	var startDate = document.getElementById('txtDate');
	startDate.value = newDate;
	document.getElementById('frmUser').submit();
}

// fieldList is comma separated, no whitespace
function chkReqdFields(formName, fieldList) {
	var arrFields;
	var i = 0
//	alert('Checking ' + formName);

	arrFields = fieldList.split(',');
	for(i = 0; i<arrFields.length; i++) {
		//alert('Checking ' + arrFields[i]);
		if(isWhitespace(eval('document.forms["' + formName + '"].' + arrFields[i] + '.value'))) {
			alert("Please fill in all required fields.");
			return false;
		}
	}
	return true;
}

// Check whether string s is empty.
function isEmpty(s) {
   return ((s == null) || (s.length == 0))
}

// whitespace characters
var whitespace = " \t\n\r";

// Returns true if string s is empty or
// whitespace characters only.
function isWhitespace (s) {   
	var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
}
}

var popupLinkConfig = new Array;

//====Popup Window Parameters==============//
// popupLinkConfig["classname"] = new Array ( "targetname", "width=550,height=350,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,location=yes,menubar=yes");
popupLinkConfig["popup"]    = new Array ( "", "width=500,height=450,scrollbars=yes,resizable=yes,menubar=no");
popupLinkConfig["glossary"] = new Array ( "help", "width=550,height=350,resizable=yes");
popupLinkConfig["coupon"]    = new Array ( "", "width=800,height=600,scrollbars=yes,resizable=yes,menubar=yes");
// ==========================================================================


function initPopupLinks()
{
  if (!document.getElementsByTagName) return true;
  var pageLinks = document.getElementsByTagName("a");
  for (var i = 0; i < pageLinks.length; i++) 
  {
    if (((pageLinks[i].className != null) && 
         (pageLinks[i].className != "")) ||
        ((pageLinks[i].parentNode.className != null) && 
         (pageLinks[i].parentNode.className != "")))
    {
      var linkClass = " " + pageLinks[i].className + " ";
      if ((linkClass == "  ") && (pageLinks[i].parentNode.className != ""))
      {
        linkClass = " " + pageLinks[i].parentNode.className + " ";
      }
      for (var theKey in popupLinkConfig) 
      {
        if (linkClass.indexOf(" " + theKey + " ") > -1)
        {
          if ((pageLinks[i].target == "") || (pageLinks[i].target == null))
          {
            pageLinks[i].target = (popupLinkConfig[theKey][0] != "") ? popupLinkConfig[theKey][0] : theKey;
          }
          pageLinks[i].settings = popupLinkConfig[theKey][1];
          pageLinks[i].onclick = popUp;
        }
      }
    }
  }
  return true;
}

function popUp()
{
  newWin = window.open(this.href, this.target, this.settings);
  newWin.focus();
  return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
  if (restore) selObj.selectedIndex=0;
}


var myrules = {
		
		'.bbyCart' : function(element){
			element.onload = function(){
				document.getElementById('frmBBYCart').submit();
			}
		},
		
		'.selectBox' : function(element){
			element.onchange = function(){
				document.editTime.submit();
			}
		},
		'.popupPrintButton' : function(element){
			element.onclick = function(){
				window.print();
			}
		},
		'.btnCloseModal' : function(element){
			element.onclick = function(){
				parent.Control.Modal.close();
			}
		},
		'.btnCloseModalMount' : function(element){
			element.onclick = function(){
				parent.document.forms["aspnetForm"].submit();
				parent.Control.Modal.close();
			}
		},
		'.btnCloseModalAlt' : function(element){
			element.onclick = function(){
				parent.Control.Modal.close();
			}
		},
		/*'#btnOk' : function(element){
			element.onclick = function(){
				parent.Control.Modal.close();
			}
		},*/
		'.nextButton' : function(element){
			
		},
		'.checkSubmit' : function(element){
			element.onclick = function(){
				document.forms["aspnetForm"].submit();
			}
		},
		//HT
		'.btnSkipStep' : function(element){
			element.onclick = function(){
				document.forms["aspnetForm"].submit();
			}
		},
		'.btnAddToSystem02' : function(element){
			element.onclick = function(){
			    var ProductList = '';
			    for (var i=0; i < document.forms["aspnetForm"].chkProduct.length; i++)
                {
                if (document.forms["aspnetForm"].chkProduct[i].checked)
                  {
                  var ProductList = ProductList + document.forms["aspnetForm"].chkProduct[i].value + ',';
                  }
                }
			    document.forms["aspnetForm"].txtRetailerProductID.value = ProductList;
				document.forms["aspnetForm"].submit();
			}
		},
		'.btnContinue' : function(element){
			element.onclick = function(){
				document.forms["aspnetForm"].submit();
			}
		},
		'.btnBuyNow' : function(element){
		    element.onclick = function(){
		        parent.document.location = 'http://www.bestbuy.com/site/olspage.jsp?skuId=8353952&type=product&id=1177112313877';
				parent.Control.Modal.close();
		    }
		},
		'.radioPopup' : function(element){
			element.onclick = function(){
			
				for (var i=0; i < document.forms["aspnetForm"].rdoSelect.length; i++)
				   {
				   if (document.forms[0].rdoSelect[i].checked)
				      {
				      var RPID = document.forms["aspnetForm"].rdoSelect[i].value;
				      }
				   }
				   
				//var chkWebAvailability = document.forms[0].chkWebAvailability.value;
				//var chkStoreAvailability = document.forms[0].chkStoreAvailability.value;
				var parentURL = parent.document.location.href;
				
				var appendChar = '?';
				if (parentURL.indexOf('?')>0) appendChar = '&';
				parent.document.location = parent.document.location + appendChar + 'popRetailerProductID=' + RPID + '&popProductID=' + document.forms[0].ProductID.value;
				parent.Control.Modal.close();
			}
		},
		'.radioPopupPost' : function(element){
			element.onclick = function(){
			
				for (var i=0; i < document.forms[0].rdoSelect.length; i++)
				   {
				   if (document.forms[0].rdoSelect[i].checked)
				      {
				      var RPID = document.forms[0].rdoSelect[i].value;
				      }
				   }
				   
				//var chkWebAvailability = document.forms[0].chkWebAvailability.value;
				//var chkStoreAvailability = document.forms[0].chkStoreAvailability.value;
				var parentURL = parent.document.location.href;
				
				var appendChar = '?';
				if (parentURL.indexOf('?')>0) appendChar = '&';
				parent.document.forms["aspnetForm"].popRetailerProductID.value = RPID;
				parent.document.forms["aspnetForm"].popProductID.value = document.forms[0].ProductID.value;
				parent.document.forms["aspnetForm"].Next.value = "N";
				//parent.document.location = parent.document.location + appendChar + 'popRetailerProductID=' + RPID + '&popProductID=' + document.forms[0].ProductID.value;
				parent.document.forms["aspnetForm"].submit();
				parent.Control.Modal.close();
			}
		},
		'.radioSubmit' : function(element){
			element.onclick = function(){
				document.forms["aspnetForm"].txtSearch.value = 'true';
				document.forms[0].submit();
			}
		},
		'.radioIndex' : function(element){
			element.onclick = function(){
			document.forms["aspnetForm"].submit();
			}
		},
		'.productLink' : function(element){
			element.onclick = function(){
				loadOpener(element.href);
				return false;
			}
		},
		'#frmTime' : function(element){
			element.onsubmit = function(){
				return chkReqdFields('frmTime','selTask');
			}
		},
		'#selAvailableTime' : function(element){
			element.onchange = function(){
				document.getElementById('frmUser').submit();
			}
		},
		'#chkShowAll' : function(element){
			element.onclick = function(){
				var formName = findParent(element.id)
				document.getElementById(formName).submit();
			}
		},
		'.btnPopupCancel' : function(element){
			element.onclick = function(){
				window.close();
			}
		},
		'.aBBReturn' : function(element){
			element.onclick = function(){
				window.close();
			}
		},
		'.saveLink' : function(element){
			element.onclick = function(){
				document.forms["aspnetForm"].secondAction.value = 'save';
				document.forms[0].submit();
			}
		},
		'fieldset' : function(element){
			element.onmouseover = function(){
				addRemoveClass('add',this,'over');
			}
			element.onmouseout = function(){
				addRemoveClass('remove',this,'over');
			}
		},
		'.submitButton' : function(element){
			element.onmouseover = function(){
				addRemoveClass('add',this,'over');
			}
			element.onmouseout = function(){
				addRemoveClass('remove',this,'over');
			}
		},
		'.productInfo' : function(element){
			var myDt = element.getElementsByTagName("dt").item(0);
			element.onmouseover = function(){
				addRemoveClass('add',this,'over');
			}
			element.onmouseout = function(){
				addRemoveClass('remove',this,'over');
			}
		},
		'.deleteProductButton' : function(element){
			element.onclick = function(){
				window.confirm("Are you sure you want to remove this item from your cart?");
			}
		}
	}

function ajaxCart(){
	var cartList = $('cartItems');
	if (!document.getElementById("cartItems")) return false;
		/*cartList.hide();*/
		Effect.BlindUp(cartList);
	var reviewLink = $('reviewDetails');
		reviewLink.onclick = function(){
			/*Element.toggle(cartList);*/
			var oldChild = reviewLink.firstChild;
			var newChild = document.createTextNode("Hide Details");
			var altChild = document.createTextNode("Review Details");
			if (oldChild.nodeValue == "Review Details"){
				reviewLink.replaceChild(newChild, oldChild);
				Effect.BlindDown(cartList);
			}
			else {
				reviewLink.replaceChild(altChild, oldChild);
				Effect.BlindUp(cartList);
			}
			return false;
		}
}

function uncheckRadio(radioname){
	
	var cBoxes = document.forms[0](radioname);
		
	for(var i=0, n=cBoxes.length; i<n; ++i){
		cBoxes[i].checked = false;
	}
}

function uncheckComputer(radioname){
	
	var cBoxes = document.forms[0](radioname);
		
	for(var i=0, n=cBoxes.length; i<n; ++i){
		cBoxes[i].checked = false;
	}
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}


//Used in Home Theater
function clickRow(obj,ToolID,ToolStepOptionID,FileName)
{    
    
    for (var i=0; i < document.forms[0].rdoTag.length; i++)
    {
    if (document.forms[0].rdoTag[i].value == ToolStepOptionID) {
        if (document.forms[0].rdoTag[i].checked) {
            document.forms[0].rdoTag[i].checked = false
        }
        else
        {
            document.forms[0].rdoTag[i].checked = true
        }
    }
    }
    
    var cont = document.getElementById('imageTable');  
    var myObjColl = getElementsByClassName('selectedType', 'tr', cont);
        for (var i = 0, j = myObjColl.length; i < j; i++) {
           
           //if (document.forms[0].rdoTag[i+1].checked){
           //     myObjColl[i].className = 'selectedType';
           //}
           //else {
                myObjColl[i].className = '';
           //}
        }
         
    obj.className='selectedType';
    document.getElementById('roomPic').innerHTML = '<img src="images/' + FileName + '" alt="" />';
    
}

function highlightRow(obj,ToolID,ToolStepOptionID,FileName)
{
    var Tag = '';
    var TagList = ''
    for (var i=0; i < document.forms[0].rdoTag.length; i++)
    {
    if (document.forms[0].rdoTag[i].checked)
      {
      Tag = document.forms[0].rdoTag[i].value;
      TagList = TagList + document.forms[0].rdoTag[i].value + ',';
      }
    }
    
    //only change row color if tag not selected or changing tag
    if (Tag == '' || Tag == ToolStepOptionID)
    {
    var cont = document.getElementById('imageTable');  
    var myObjColl = getElementsByClassName('selectedType', 'tr', cont);
        for (var i = 0, j = myObjColl.length; i < j; i++) {
        
           //if (document.forms[0].rdoTag[i+1].checked){
           //     myObjColl[i].className = 'selectedType';
           //}
           //else {
                myObjColl[i].className = '';
           //}
        }
         
    obj.className='selectedType';
    document.getElementById('roomPic').innerHTML = '<img src="images/' + FileName + '" alt="" />';
    }
}

//Computer or Camera Code for Skill Page
function skillCheck()
{
    var Skill = '';
    for (var i=0; i < document.forms[0].rdoSkillID.length; i++)
    {
    if (document.forms[0].rdoSkillID[i].checked)
      {
      var Skill = document.forms[0].rdoSkillID[i].value;
      }
    }
    
    if (Skill == '')
    {
        alert('You must select an option before continuing.');
        return false
    }

}

//DI / Computer Code for Prompt
function questionModal() 
{ 
    var Tag = '';
    for (var i=0; i < document.forms[0].rdoTag.length; i++)
    {
    if (document.forms[0].rdoTag[i].checked)
      {
      var Tag = document.forms[0].rdoTag[i].value;
      }
    }
    
    if (document.forms[0].Required.value == 'Y')
    {
        if (Tag == '')
        {
            alert('You must select an option before continuing.');
            return false
        }
        else {
            document.forms[0].submit();
        }
    }
    else
        {
        document.forms[0].submit();
        }
} 

//HT Code for Launching Dimension Questions

function customModal() 
{ 
    var Tag = '';
    var Check = false;
    for (var i=0; i < document.forms[0].rdoTag.length; i++)
    {
    if (document.forms[0].rdoTag[i].checked)
      {
      var Tag = document.forms[0].rdoTag[i].value;
      }
    }
    
    if (document.forms[0].Required.value == 'Y')
    {
        if (Tag == '')
        {
            alert('You must select an option before continuing.');
            return false
        }
        else {
            //document.forms[0].submit();
            Check = true
        }
    }
    else
    {
        //document.forms[0].submit();
        Check = true
    }
        
    if (Check) {   
        var ToolStepID = document.forms[0].txtToolStepID.value;
        request.open("GET", 'popupCheck.ashx?ToolStepID=' + ToolStepID + '&ToolStepOptionID=' + Tag); 
        request.onreadystatechange = server_interaction_modal;
        request.send('');
    }
} 


function loadCompare(){
    
    var ProductList = '';
    var x = 0
    
    var myProducts = new Array()
    for (var i=0; i < document.forms[0].chkCompare.length; i++)
    {
    if (document.forms[0].chkCompare[i].checked)
      {
      var ProductList = ProductList + document.forms[0].chkCompare[i].value + ',';
      myProducts[x] =  document.forms[0].chkCompare[i].value;
      x = x + 1
      }
    }
    
    var Redirect = 'Yes';
    
    if (myProducts.length < 2)
    {   
        alert('You must select between 2-5 products to compare.');
        Redirect = 'No';
    } 
    
     if (myProducts.length > 5)
    {   
        alert('You may only select 5 products to compare.');
        Redirect = 'No';
    } 
    
    if (Redirect == 'Yes') {
        document.forms[0].CompareList.value = myProducts;
        document.forms[0].submit();
    }
}

function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}

// To cover IE 5.0's lack of the push method
Array.prototype.push = function(value) {
  this[this.length] = value;
}


function loadOpener(theURL)
{
if(self.opener)
{
    if (self.opener.closed)
    {
    window.open(theURL);
    }
    else
    {
    self.opener.location.href = theURL;
    self.opener.focus();
    }
}
else
{
    window.open(theURL);
}    
return false;
}


//Used in Home Theater
function addProduct(RetailerProductID, LaunchPopup)
{
    document.forms[0].txtRetailerProductID.value = RetailerProductID;
    
    if (LaunchPopup == 'Y') {
    
        request.open("GET", 'checkPopup.aspx?RetailerProductID=' + RetailerProductID); 
	    request.onreadystatechange = sever_interaction;
	    request.send('');
    }
    else {
        document.forms[0].submit();
    }
}


//Used for TV Popup
function creat_Object()
{ 
var xmlhttp;
// This if condition for Firefox and Opera Browsers 
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
{
try 
{
xmlhttp = new XMLHttpRequest();
} 
catch (e) 
{
alert("Your browser is not supporting XMLHTTPRequest");
xmlhttp = false;
}
}
// else condition for ie
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}

var request = creat_Object();


function server_interaction_modal()
{
	if(request.readyState == 4)
	{
	    var answer = request.responseText;
	    myString = answer
        //alert(myString);
                
        if (parseFloat(myString) > 0)
        {
            modal = new Control.Modal($('Popup'),{ iframe: true, width: 540, height: 350 });
            modal.href= 'pStepDetail.aspx?ToolStepID=' + myString;
            modal.open();
        }
        else {
            document.forms[0].submit();
        }
	}
}


//End of TV Popup


//Bluefish Add to Cart (Options)
function updateProduct(ToolStepID, ToolGroupID, RetailerProductID, SessionLink){
    var guid = generateGuid();
    document.forms[0].hfRetailerProductID.value = RetailerProductID;

	request.open("GET", "cartDetail.aspx?SID=" + SessionLink + "&ToolStepID=" + ToolStepID + "&ToolGroupID=" + ToolGroupID + "&RetailerProductID=" + RetailerProductID + "&random=" + guid); 
	request.onreadystatechange = server_interaction_product;
	request.send('');
}

function server_interaction_product()
{
	if(request.readyState == 4)
	{
	var answer = request.responseText;
	document.getElementById('add' + document.forms[0].hfRetailerProductID.value).innerHTML='<a class="added" href="#">ADDED</a>';
	//document.getElementById('shoppingCart').innerHTML = answer;
	}
}




//Bluefish Accessory Page
function change_number(way, RetailerProductID) {
    if (way == "up") {
        var Qty = document.getElementById('txtQty' + RetailerProductID).value;
        Qty++;
        document.getElementById('txtQty' + RetailerProductID).value = Qty;
        if (Qty > 0) {
            identity=document.getElementById('txtQty' + RetailerProductID + 'Down');
            identity.className = 'down';
        }
    } else if (way == "down") {
        var Qty = document.getElementById('txtQty' + RetailerProductID).value;
        if (Qty > 0) {
            Qty--;
            document.getElementById('txtQty' + RetailerProductID).value = Qty;
            
            if (Qty == 0) {
            identity=document.getElementById('txtQty' + RetailerProductID + 'Down');
            identity.className = 'down passed';
            }
        }
    }
    return false;
}

function addProduct(URL,RetailerProductID) {

    var selectedProduct = document.getElementById('selColor' + RetailerProductID).value
    document.location.href = URL + '&RetailerProductID=' + selectedProduct + '&action=add';
}

//=======Onload=============//
  
//window.onload=function(){
// externalLinks();
// initPopupLinks();
// Behaviour.register(myrules);
//}


	var dhtmlgoodies_lifestyletip = false;
	var dhtmlgoodies_lifestyletipShadow = false;
	var dhtmlgoodies_shadowSize = 4;
	var dhtmlgoodies_lifestyletipMaxWidth = 250;
	var dhtmlgoodies_lifestyletipMinWidth = 100;
	var dhtmlgoodies_iframe = false;
	var lifestyletip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;
	



	function showLifestyletip(e,lifestyletipTxt)
	{
		
		var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
	
		if(!dhtmlgoodies_lifestyletip){
			dhtmlgoodies_lifestyletip = document.createElement('DIV');
			dhtmlgoodies_lifestyletip.id = 'dhtmlgoodies_lifestyletip';
			dhtmlgoodies_lifestyletipShadow = document.createElement('DIV');
			dhtmlgoodies_lifestyletipShadow.id = 'dhtmlgoodies_lifestyletipShadow';
			
			document.body.appendChild(dhtmlgoodies_lifestyletip);
			document.body.appendChild(dhtmlgoodies_lifestyletipShadow);	
			
			if(lifestyletip_is_msie){
				dhtmlgoodies_iframe = document.createElement('IFRAME');
				dhtmlgoodies_iframe.frameborder='5';
				dhtmlgoodies_iframe.style.backgroundColor='#FFFFFF';
				dhtmlgoodies_iframe.src = '#'; 	
				dhtmlgoodies_iframe.style.zIndex = 100;
				dhtmlgoodies_iframe.style.position = 'absolute';
				document.body.appendChild(dhtmlgoodies_iframe);
			}
			
		}
		
		dhtmlgoodies_lifestyletip.style.display='block';
		dhtmlgoodies_lifestyletipShadow.style.display='block';
		if(lifestyletip_is_msie)dhtmlgoodies_iframe.style.display='block';
		
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
		var leftPos = e.clientX + 10;
		
		dhtmlgoodies_lifestyletip.style.width = null;	// Reset style width if it's set 
		dhtmlgoodies_lifestyletip.innerHTML = lifestyletipTxt;
		dhtmlgoodies_lifestyletip.style.left = leftPos + 'px';
		dhtmlgoodies_lifestyletip.style.top = e.clientY - 50 + st + 'px';

		
		dhtmlgoodies_lifestyletipShadow.style.left =  leftPos + dhtmlgoodies_shadowSize + 'px';
		dhtmlgoodies_lifestyletipShadow.style.top = e.clientY - 50 + st + dhtmlgoodies_shadowSize + 'px';
		
		if(dhtmlgoodies_lifestyletip.offsetWidth>dhtmlgoodies_lifestyletipMaxWidth){	/* Exceeding max width of lifestyletip ? */
			dhtmlgoodies_lifestyletip.style.width = dhtmlgoodies_lifestyletipMaxWidth + 'px';
		}
		
		var lifestyletipWidth = dhtmlgoodies_lifestyletip.offsetWidth;		
		if(lifestyletipWidth<dhtmlgoodies_lifestyletipMinWidth)lifestyletipWidth = dhtmlgoodies_lifestyletipMinWidth;
		
		
		dhtmlgoodies_lifestyletip.style.width = lifestyletipWidth + 'px';
		dhtmlgoodies_lifestyletipShadow.style.width = dhtmlgoodies_lifestyletip.offsetWidth + 'px';
		dhtmlgoodies_lifestyletipShadow.style.height = dhtmlgoodies_lifestyletip.offsetHeight + 'px';		
		
		if((leftPos + lifestyletipWidth)>bodyWidth){
			dhtmlgoodies_lifestyletip.style.left = (dhtmlgoodies_lifestyletipShadow.style.left.replace('px','') - ((leftPos + lifestyletipWidth)-bodyWidth)) + 'px';
			dhtmlgoodies_lifestyletipShadow.style.left = (dhtmlgoodies_lifestyletipShadow.style.left.replace('px','') - ((leftPos + lifestyletipWidth)-bodyWidth) + dhtmlgoodies_shadowSize) + 'px';
		}
		
		if(lifestyletip_is_msie){
			dhtmlgoodies_iframe.style.left = dhtmlgoodies_lifestyletip.style.left;
			dhtmlgoodies_iframe.style.top = dhtmlgoodies_lifestyletip.style.top;
			dhtmlgoodies_iframe.style.width = dhtmlgoodies_lifestyletip.offsetWidth + 'px';
			dhtmlgoodies_iframe.style.height = dhtmlgoodies_lifestyletip.offsetHeight + 'px';
		
		}
				
	}
	
	function hideLifestyletip()
	{
		dhtmlgoodies_lifestyletip.style.display='none';
		dhtmlgoodies_lifestyletipShadow.style.display='none';		
		if(lifestyletip_is_msie)dhtmlgoodies_iframe.style.display='none';		
	}
	
function generateGuid()
{
var result, i, j;
result = '';
for(j=0; j<32; j++)
{
if( j == 8 || j == 12|| j == 16|| j == 20)
result = result + '-';
i = Math.floor(Math.random()*16).toString(16).toUpperCase();
result = result + i;
}
return result
} 