//order confirmation and order receipt page - split the email address on the RHN if too long
var splitEmailAdd = function(usemail) {
	var stringlist = new Array();
	while (usemail.length > 30) {
	   stringlist.push( usemail.slice(0,30));
	   usemail=usemail.substr(30);
	}
	if (usemail.length) {
	  stringlist.push(usemail);
	}
	document.write(stringlist.join( '<br>' ));
}

//dynamic nav script
turnonToggle = 1; //change this to 0 if you don't want to use toggling
// preload controls
// change path to the desired location
shown = new Image();
shown.src = "/venda-support/images/bulleton.gif";
hidden = new Image();
hidden.src = "/venda-support/images/bulletoff.gif";

var dynamicContent=function(where,what) {
	// find out what tag the function is called from so the correct value is passed for url
	identifyTag = where.tagName;
	if (identifyTag == "A"){
		ajaxFunction(where+'&layout=noheaders&temp=subcategories',what);
		if (turnonToggle == 1){toggle(where);}
	} else if (identifyTag == "INPUT" || identifyTag == "SELECT") {
		ajaxFunction(where.value,what);
	}
}

//dynamic popup window script
// images default to venda-support directory, change the path to ebiz resources directory if you need to source your own versions
mingif = '/venda-support/images/min.gif';
closegif = '/venda-support/images/close.gif';
restoregif = '/venda-support/images/restore.gif';
resizegif = '/venda-support/images/resize.gif';

var dynamicWindow=function (where,name) {
	detailWin=dhtmlwindow.open('productdetailWin', 'iframe', where+'&layout=iframe&temp=productdetail_layer', name, 'width=650px,height=400px,resize=1,scrolling=1,center=1');
}
// you may edit the parameters in the final argument above to alter the appearance of the popup window

//Description: Returns the value of a specified URL parameter 
//Parameters:
//1. currURL = this is the URL which you wish to get the URL parameter value from
//2. urlParam = this is the name of the URL parameter you want to get the value for
//Returns: value for parameter specified urlParam.
var grabURL=function (currURL,urlParam) {
	//find out a value where is passed from current url
	var url = unescape(currURL);
	var spliter = '&';
	var sField = spliter+urlParam+'=';
	
	if (url.search(sField) == -1) {               
		sField = '?'+urlParam+'=';         
	}
	
	var urlArray = url.split(sField);
	if (urlArray[1]) {
		//get url param value
		var paramArray = urlArray[1].split(spliter);
		return(paramArray[0]);
	}
}

var popup=function(url,width,height,name){
	if (width == null) width = 400;
	if (height == null) height = 425;
	if (name == null) name = "details";
	var props = "toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,titlebar=no,menubar=no,width="+width+",height="+height;
		w = window.open(url, name, props);
		if (w) {
			w.focus();
		}
}
/** 
    * @fileoverview Venda.Widget.EqualHeight 
    * 
    * This widget give us the ability to set the same height for the html element. 
    * Mostly use to format the product within the same row by set the same height for each html element. 
    * 
    * Adapted from Aron San's code in RT#66087 
    * @author arsp <arsp@venda.com> 
    */ 
    
   //create namespace 
   var equalHeight = Venda.namespace('Widget.EqualHeight'); 
    
   /** 
    * @constructor 
    * @requires JQuery             /venda-support/js/external/jquery-1.2.2.js 
    */ 
    
   //set jQuery object 
   equalHeight.jq = jQuery; 
    
   /** 
    * this function will get the list of html element and class name that need to set height 
    * then set height of each element by using function 'set' 
    * 
    *  @param {Array} ElementsToSet - Array that contain html element with class name under html tag e.g. 'li .invtname' 
    * 
    */ 
   equalHeight.init = function(ElementsToSet) { 
           var ElementsToSetLen = ElementsToSet.length; 
           equalHeight.jq(document).ready(function(){ 
                   for (var i=0; i < ElementsToSetLen; i++) { 
                           equalHeight.set(ElementsToSet[i]); 
                   } 
           }); 
   } 
    
   /** 
    * this function will find the max height of each class and set the max height to that class 
    * 
    * @param {Element} each value in Array - the html element and class name to set height 
    */ 
   equalHeight.set = function(setClass) { 
           var maxHeight = 0; 
           equalHeight.jq(setClass).each(function() { 
                   var curHeight = equalHeight.jq(this).height(); 
                   if (curHeight >= maxHeight) { 
                           maxHeight = curHeight; 
                   } 
           }); 
           equalHeight.jq(setClass).height(maxHeight); 
   } 
    
   /** 
    ***** code below is the example of how to call this function. code need to be placed in the template which it will be used **** 
    * var productInfo = new Array ('li .productname', 'li .brd_featprods', 'li .iconbox', 'li .invtdesc2', 'li .font-red'); 
    * Venda.Widget.EqualHeight.init(productInfo); 
    */ 
function setEqualHeight(){
			/*var id_one = document.getElementById("col-one");
			var id_two = document.getElementById("col-two-three");

			alert(id_one.offsetHeight);
			alert(id_two.offsetHeight);
			
			if (id_one.offsetHeight > id_two.offsetHeight){
				document.getElementById("col-two-three").style.height = id_one.offsetHeight + "px";
			}
			else if (id_one.offsetHeight < id_two.offsetHeight){
				document.getElementById("col-one").style.height = id_two.offsetHeight + "px";
			}*/
			
	 	}
		
