<!--
// Setup page level variables
var everythingLoaded =false
var linkClicked = false
var ajaxBoxLoaded = false
var BROWSER_IE4 = "IE4"
var BROWSER_NN4 = "NN4"
var BROWSER_IE = "IE"
var BROWSER_VER
BROWSER_VER = checkBrowser()
xMousePos = 0
yMousePos = 0
xMousePosMax = 0
yMousePosMax = 0
var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");

function detectBrowser() {
            BROWSER_TYPE="";
            aname=navigator.appName;
            anav=navigator.userAgent;
          
            if(aname=="Microsoft Internet Explorer"){
                if(anav.indexOf("Opera")>-1){
                    BROWSER_TYPE="OP";
                }
                else
                {
                    BROWSER_TYPE="IE";
                }
            }
            if(aname=="Netscape"){
                if(anav.indexOf("Firefox")>-1)
                {
                BROWSER_TYPE="FF";
                }
                if(anav.indexOf("Navigator")>-1)
                {
                BROWSER_TYPE="NS";
                }   
                if(anav.indexOf("Safari")>-1)
                {
                BROWSER_TYPE="SF";
                }
                
            }
            if(aname=="Opera"){
                BROWSER_TYPE="OP";
            }
            return(BROWSER_TYPE)
        }
        
function showSingleLevelTable(tableToShow,position,leftPos,topPos,leftAdj,topAdj){
//alert("|")
	if (everythingLoaded == true){
		
		if (tableToShow == "basketSummaryMenu") {
			
			if (detectBrowser() == "SF") {
				//alert(getTop(position));
				topAdj = topAdj + 20;
				var lyr = getMyHTMLElement(tableToShow);
				lyr.style.left =(getLeft(position) + leftAdj )+ "px";
				lyr.style.top = (getTop(position) + topAdj) + "px";
				// added - to have same width as holder_BASKETHEADER
				//getMyHTMLElement('basketSummaryMenu').style.width = getMyHTMLElement('holder_BASKETHEADER').clientWidth + 'px';
				showDisplayTable(tableToShow)
			}
			else {
				
				var lyr = getMyHTMLElement(tableToShow);
				lyr.style.left =(getLeft(position) + leftAdj )+ "px";
				lyr.style.top = (getTop(position) + topAdj) + "px";
				// added - to have same width as holder_BASKETHEADER
				//getMyHTMLElement('basketSummaryMenu').style.width = getMyHTMLElement('holder_BASKETHEADER').clientWidth + 'px';
				showDisplayTable(tableToShow)
				
			}
			
		}
		else {
		
			var lyr = getMyHTMLElement(tableToShow);
			lyr.style.left =(getLeft(position) + leftAdj )+ "px";
			lyr.style.top = (getTop(position) + topAdj) + "px";
			showDisplayTable(tableToShow)
		
		}
	
	}
}

//added for REM -- Put Share This on product detail page (#151270) - Daeheon Kim - 09/10/2009 
function showSingleLevelTableSocial(tableToShow,position,leftPos,topPos,leftAdj,topAdj){
//alert("|")
	if (everythingLoaded == true){
		    if (detectBrowser() == "SF") {
				//alert(getTop(position));
				topAdj = topAdj;
				var lyr = getMyHTMLElement(tableToShow);
				lyr.style.left =(getLeft(position) + leftAdj )+ "px";
				lyr.style.top = (getTop(position) + topAdj) + "px";
				showDisplayTable(tableToShow)
			}
			else {
				
				var lyr = getMyHTMLElement(tableToShow);
				lyr.style.left =(getLeft(position) + leftAdj )+ "px";
				lyr.style.top = (getTop(position) + topAdj) + "px";
				showDisplayTable(tableToShow)	
			}
			
		}
		else {
		
			var lyr = getMyHTMLElement(tableToShow);
			lyr.style.left =(getLeft(position) + leftAdj )+ "px";
			lyr.style.top = (getTop(position) + topAdj) + "px";
			showDisplayTable(tableToShow)
		}
	
}
//ends for REM -- Put Share This on product detail page (#151270) - Daeheon Kim - 09/10/2009 





function thinkAboutHidingTable(tableToHide){thinkAboutTimeOut = setTimeout("hideDisplayTable('"+tableToHide+"')",1000);}
function forgetAboutHidingTable(tableToHide){if (typeof thinkAboutTimeOut != 'undefined') {clearTimeout(thinkAboutTimeOut)}}

function strLeft(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function strRight(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function checkBrowser() {
	var BROWSER_VER;
	if (document.all && !document.getElementById) 
		BROWSER_VER = BROWSER_IE4
	else if (document.layers) 
		BROWSER_VER = BROWSER_NN4
	else if (document.getElementById) 
		BROWSER_VER = BROWSER_IE
	else 
		BROWSER_VER = BROWSER_IE
	return(BROWSER_VER)
}

function OpenWindow(PageName,PageFrame,PageProperties) { //v2.0
  PageProperties= PageProperties +',scrollbars=1,resizable=1'
  MyWindow = window.open (PageName,PageFrame,PageProperties)
}

function showDisplayTable(tableToShow){
    if (getMyHTMLElement(tableToShow) != null){
	    getMyHTMLElement(tableToShow).style.display='block';
	}
}

function hideDisplayTable(tableToHide){
    if (getMyHTMLElement(tableToHide) != null){
	    getMyHTMLElement(tableToHide).style.display='none';
    }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function swapImage(imageName,imageFile){
	
	var swapImageName = eval('getMyHTMLElement(\'' + imageName + '\')');
	if (typeof(swapImageName) != 'undefined'){
	swapImageName.src = imageFile;
	}
	
}

/* START FUNCTIONS FOR PRODUCT IMAGE TRANSITION */

var fadeOutValue;
var fadeOutTimeout;
var fadeImageName;
var fadeImageFile;
function fadeProductImageOut(imageName, value, imageFile) {
	clearTimeout(fadeOutTimeout);
	
	if (value == null) {
		value = 100;	
	}

	if (value >= 0) {
		
	
		if (detectBrowser()=="IE") {
			imageName.style.filter = 'alpha(opacity=' + (value) + ')';
		}
		else {
			imageName.style.opacity = value / 100;
			imageName.style.MozOpacity = value / 100;	
		}
		
		value = value - 10;
		
		fadeOutValue = value;
		fadeImageName = imageName;
		fadeImageFile = imageFile;
		fadeOutTimeout = setTimeout("fadeProductImageOut(fadeImageName, fadeOutValue, fadeImageFile)", 20);
	}
	else {
		clearTimeout(fadeOutTimeout);
		imageName.src = imageFile;
		fadeProductImageIn(imageName);
	}
		
}

var fadeInValue;
var fadeInTimeout;

function fadeProductImageIn(imageName, value) {
	clearTimeout(fadeInTimeout);
	if (value == null) {
		value = 0;	
	}
	
	
	
	if (value <= 100) {
		
		
		if (detectBrowser()=="IE") {
			imageName.style.filter = 'alpha(opacity=' + (value) + ')';
		}
		else {
			imageName.style.opacity = value / 100;
			imageName.style.MozOpacity = value / 100;	
		}
		
		value = value + 10;
		
		fadeInValue = value;
		fadeImageName = imageName;
		fadeInTimeout = setTimeout("fadeProductImageIn(fadeImageName, fadeInValue)", 20);
	}
	else {
		
		
		
		clearTimeout(fadeInTimeout);
	}
		
}

var transitionImageName;
var transitionImageFile;
var transitionTimeout;

function swapImageFade(imageName,imageFile) {
	clearTimeout(transitionTimeout);
	clearTimeout(transitionDelayTimeout);
	var myImage =  new Image();
	myImage.src = imageFile;

	if (myImage.complete) {
		document.getElementById('smlloadingdiv').style.display = 'none';
		imageTransition(imageName,imageFile);
	}
	else {
		document.getElementById('smlloadingdiv').style.display = 'block';
		transitionImageName = imageName;
		transitionImageFile = imageFile;
		transitionTimeout = setTimeout("swapImageFade(transitionImageName,transitionImageFile)", 100);;
		
	}
}

var delayingSwap;
var transitionDelayTimeout;
var transitionDelayImageName;
var transitionDelayImageFile;
function swapImageFadeOut(imageName,imageFile) {
	
	transitionDelayImageName = imageName;
	transitionDelayImageFile = imageFile;
	transitionDelayTimeout = setTimeout("swapImageFade(transitionDelayImageName,transitionDelayImageFile)", 200);
	
}

function imageTransition(imageName,imageFile){
	
	//alert('');
	var swapImageName = eval('getMyHTMLElement(\'' + imageName + '\')');
	if (typeof(swapImageName) != 'undefined'){
	
		//alert(swapImageName.src + ' , ' + imageFile);
	
		if (swapImageName.src != imageFile) {
	
			fadeProductImageOut(swapImageName, 100, imageFile);	
		}
	}
	
}
/* END FUNCTIONS FOR PRODUCT IMAGE TRANSITION */

function getTop(item){
var top =0;
var mywhere;
mywhere = getMyHTMLElement(item);
	while (mywhere.tagName.toLowerCase() != 'body')
	{
	top += mywhere.offsetTop;
	mywhere = mywhere.offsetParent;
	}
return top;
}

function getLeft(item){
var left =0;
var mywhere;
mywhere = getMyHTMLElement(item);
	while (mywhere.tagName.toLowerCase() != 'body')
	{
	left += mywhere.offsetLeft;
	mywhere = mywhere.offsetParent;
	}
return left;
}

function printPage(){window.print()}

function addToFavorite(urlToAdd,titleToAdd){window.external.AddFavorite(urlToAdd,titleToAdd)}


function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


function open_win(url,wname,attr)
{
	if (wname=='undefined') wname = "win"
	if (attr=='undefined') attr = "toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=0,resizable=0,width=645,height=540"
	var new_win = window.open(url, wname, attr);
	new_win.focus();
}

function addprod_to_basket(sformname){
var oform = document.forms[sformname]
oform.submit()}

function addprod_to_wishlist(sformname,surl){
var oform = document.forms[sformname]
oform.action = surl;
oform.submit()}


function limittext(field, maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
}

function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin"; 
}
			
function popUp2(url,w,h) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width='+w+',height='+h);
	self.name = "mainWin"; 
}

function getMyHTMLElement(sid)
{
	var oelement;
	if(BROWSER_VER==BROWSER_IE4)
		oelement = document.all[sid]
	else if(BROWSER_VER==BROWSER_NN4)
		oelement = document.layers[sid]
	else if(BROWSER_VER==BROWSER_IE)
		oelement = document.getElementById(sid)
	else
		oelement = document.getElementById(sid)
	return(oelement)
}


function LTrim(str)
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str)
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

      var i = s.length - 1;       // Get length of string

      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;

      s = s.substring(0, i+1);
   }

   return s;
}

function Trim(str)
{
   return RTrim(LTrim(str));
}

function replaceString(aSearch, aFind, aReplace)
    {
    result = aSearch;
    if (result != null && result.length > 0)
        {
        a = 0;
        b = 0;
        while (true)
            {
            a = result.indexOf(aFind, b);
            if (a != -1)
                {
                result = result.substring(0, a) + aReplace + result.substring(a + aFind.length);
                b = a + aReplace.length;
            }
            else
            break;
        }
    }
    return result;
}

var currentSearchAutoCompleteSelection = 0;
function checkKeyAndActOnIt(e){
     var key;
     if(window.event){
          key = window.event.keyCode;     //IE
          }
     else{
          key = e.which;     //firefox
    }
    // Only attempt selection if results exist:
    if (getMyHTMLElement('SearchDrop').childNodes[0].childNodes.length > 0){
        // If customer presses the down arrow then act on this.
        if (key == 40){
            // If there is nothing selected, then select the first node
            if (currentSearchAutoCompleteSelection  == 0) {
                getMyHTMLElement('SearchDrop').childNodes[0].childNodes[0].className = "selected"
            }
            // If there is something selected then select the next one
            else {
                
            }
        }
        // If the customer presses an up arrow, then act on this.
        else if (key = 38){}
        else{
            currentSearchAutoCompleteSelection = 0
        }
    }
}

function submitIfEnterKey(e,d){
     var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
     if(key == 13){
		startSearch();
     }
}

function startSearch(){
	resetQuickSearch('QuickSearchBox')
	var search_entered = getMyHTMLElement('QuickSearchBox')
	if (search_entered != ""){
	document.QS1.name.value = search_entered.value
	document.QS1.submit()
	}
}
function resetQuickSearch(formStart,valOpt){
	var search_entered = getMyHTMLElement(formStart)
	if (search_entered.value == valOpt){
	search_entered.value = '';
	}
}
function resetQuickSearchBack(formStart,valOpt){
	var search_entered = getMyHTMLElement(formStart)
	if (search_entered.value == ''){
	search_entered.value = valOpt;
	}
}

function isStringANumber(string) {
    if (string.length == 0)
        return false;
    for (var i=0;i < string.length;i++)
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9')){
            return false;
    }
    return true;
}

function selectTab(tabNumber,maxNumberOfTabs){
//    var maxNumberOfTabs = 2
    for (i=1;i<=maxNumberOfTabs;i++){
        getMyHTMLElement('tab' + i).className='tabhead';
        getMyHTMLElement('tabBox' + i).style.display ='none';
    }
    getMyHTMLElement('tab' + tabNumber).className='tabheadselectedtab';
    getMyHTMLElement('tabBox' + tabNumber).style.display ='';
}

function selectTabBottom(tabNumber,maxNumberOfTabs){
    //var maxNumberOfTabs = 2
    for (i=1;i<=maxNumberOfTabs;i++){
    //alert(i + typeof(getMyHTMLElement('btab' + i)));
    //alert(i + typeof(getMyHTMLElement('btabBox' + i)));
        getMyHTMLElement('btab' + i).className='';
        getMyHTMLElement('btabBox' + i).style.display ='none';
    }
    getMyHTMLElement('btab' + tabNumber).className='tabselected';
    getMyHTMLElement('btabBox' + tabNumber).style.display ='';
}


var valueForOverlay = 0;
var linkBoxForOverlay = ""

function showPopupA(editorial_content){
    getMyHTMLElement('ajaxEditorial').style.left = ((document.documentElement.clientWidth - 600) /2) + 'px';
    getMyHTMLElement('ajaxEditorial').style.top = ((document.documentElement.clientHeight - 400) /2) + document.documentElement.scrollTop + 'px';
    ajaxGET('ajx_viewindex.asp?article_id=' + editorial_content,'ajaxEditorial',false);
    showPopup('ajaxEditorial')

}

function showPopupSized(divTag,width,height){
	
	//set size
	getMyHTMLElement(divTag).style.width = width + 'px';
	getMyHTMLElement(divTag).style.height = height + 'px';
	
	//set position
	//alert(document.documentElement.clientWidth)
    getMyHTMLElement(divTag).style.left = ((document.documentElement.clientWidth - width) /2) + 'px';
    getMyHTMLElement(divTag).style.top = ((document.documentElement.clientHeight - height) /2) + document.documentElement.scrollTop + 'px';

	showPopup(divTag)
}



function getContentHeight() {
	
	var allTags = new Array();
	var contentHeight = 0;
	var spacingHeight = 0;
	
	allTags = document.getElementsByTagName('div');
	
	for (i=0;i<allTags.length;i++){
		
		if (allTags[i].className=="FULLWIDTH"){
			spacingHeight = allTags[i].offsetTop - contentHeight;
			//alert(spacingHeight);
			contentHeight = contentHeight + allTags[i].offsetHeight + spacingHeight;
		}
	
	}
	
	return contentHeight;
	
}


function showPopup(link){
	
    linkBoxForOverlay = link;

	var contentHeight = getContentHeight();
	getMyHTMLElement('overlayBox').style.height = contentHeight + 30 + 'px';
	
    if (window.sidebar){fadeTimer = setTimeout("MOZ(linkBoxForOverlay)",1)}
    else{
        if (document.all){fadeTimer = setTimeout("IE(linkBoxForOverlay)",1)}
        else{fadeTimer = setTimeout("MOZ(linkBoxForOverlay)",1)}
    }
	getMyHTMLElement('overlayBox').style.display='block';
	initialised = false; //disable zoom when launching popup;
}


function setPosition(obj, container, ref) {
	
	var xpos = getMyHTMLElement(container).offsetLeft + getMyHTMLElement(ref).offsetLeft;
	var ypos = getMyHTMLElement('holder_HEADER').offsetHeight + getMyHTMLElement('holder_BACKGROUND').offsetHeight;
	//alert(ypos);
	//alert(getMyHTMLElement(container).offsetLeft);
	var object = getMyHTMLElement(obj);
	//alert(obj);
	object.style.left = xpos + "px";
	object.style.top = ypos + "px";
}

function showOverlay(){
    getMyHTMLElement('webSiteoverlayBox').style.left = '0px';
    getMyHTMLElement('webSiteoverlayBox').style.top = '0px';
    getMyHTMLElement('webSiteoverlayBox').style.display='block';
    getMyHTMLElement('webSiteoverlayBox').style.height=document.body.offsetHeight + 'px';
    getMyHTMLElement('webSiteoverlayBox').style.width=document.body.offsetWidth+'px';
}


function hidePopup(){
    //getMyHTMLElement('overlayContent').style.display='none';
    getMyHTMLElement('overlayBox').style.display='none';
	initialised = true; // re enable zoom when closing popup.
    if (window.sidebar){document.getElementById("overlayBox").style.MozOpacity=0;}
    if (document.all){document.getElementById("overlayBox").filters[0].opacity=0;}
    valueForOverlay = 0;
    if (linkBoxForOverlay !='') {hideDisplayTable(linkBoxForOverlay)}
    hideAllSelectTags(false)
    //document.documentElement.style.overflow = 'auto'
    //fadeTimer = "";
		
	
    }
	
function MOZ(link){
    if (valueForOverlay < 70){
        valueForOverlay = valueForOverlay + 10
        getMyHTMLElement("overlayBox").style.MozOpacity= valueForOverlay/100           		   
		getMyHTMLElement("overlayBox").style.opacity  = valueForOverlay/100  ;
		getMyHTMLElement("overlayBox").style.KhtmlOpacity = valueForOverlay/100 ;
        fadeTimer = setTimeout("MOZ(linkBoxForOverlay)",1)
    }
    else{
        hideAllSelectTags(true);
		//alert(linkBoxForOverlay);
        showDisplayTable(linkBoxForOverlay)
        //getMyHTMLElement('overlayContent').style.left = '40%'
        //getMyHTMLElement('overlayContent').style.display='block';
        //alert(navigator.appVersion.indexOf("Safari"));
        //if(navigator.appVersion.indexOf("Safari")>0){
            //getMyHTMLElement('overlayContent').style.top = (parseInt(document.documentElement.clientHeight)/2)- parseInt(getMyHTMLElement('overlayContent').offsetHeight)/2 + parseInt(document.body.scrollTop)+"px";
        //}else{
            //alert((parseInt(window.screen.height)/2)+","+ parseInt(getMyHTMLElement('overlayContent').offsetHeight)/2+ "," + parseInt(document.documentElement.scrollTop));
    
            //getMyHTMLElement('overlayContent').style.top = (parseInt(document.documentElement.clientHeight)/2)- parseInt(getMyHTMLElement('overlayContent').offsetHeight)/2 + parseInt(document.documentElement.scrollTop)+"px";
        //} 
    //end timeout
    }
}
function IE(link){
    if (valueForOverlay < 70){
        valueForOverlay = valueForOverlay + 10
        //document.getElementById("overlayBox").filters[0].opacity=valueForOverlay 
		document.getElementById("overlayBox").style.filter='alpha(opacity=' + valueForOverlay +')';
        fadeTimer = setTimeout("IE(linkBoxForOverlay)",1)
    }
    else{
		
        hideAllSelectTags(true)
	    showDisplayTable(linkBoxForOverlay)
	    //getMyHTMLElement('overlayContent').style.left = (parent.document.body.offsetWidth  - 400) /2+"px"
        //getMyHTMLElement('overlayContent').style.display='block';
        //getMyHTMLElement('overlayContent').style.top = document.documentElement.clientHeight/2- getMyHTMLElement('overlayContent').clientHeight/2 + document.documentElement.scrollTop+"px";
        ////alert(  document.getElementById('overlayContent').clientHeight);
       //if(navigator.appVersion.indexOf("Safari")>0){
       //getMyHTMLElement('overlayContent').style.top = (parseInt(document.documentElement.clientHeight)/2)- parseInt(getMyHTMLElement('overlayContent').offsetHeight)/2 + parseInt(document.body.scrollTop)+"px";
       
   //}
    }
}

function hideAllSelectTags(OnOrOff){
    if (is_ie6==true){
        var mainIdOnPage = 'holder_MAIN'
        var div = document.getElementById(mainIdOnPage);
        var x = div.getElementsByTagName("select");   
        for(var i=0;i<x.length;i++){
            if (OnOrOff==true) {
                zoomActivatedWithoutPopup = false
                x[i].style.visibility = 'hidden';
            }
            else{
                zoomActivatedWithoutPopup = true
                x[i].style.visibility = 'visible';
            }
        }
    }
}

/*
function hidePopup(){
	
   if ( getMyHTMLElement('overlayContent')!=null)
   {
        getMyHTMLElement('overlayContent').style.display='none';
   }
   if ( getMyHTMLElement('overlayBox')!=null)
   {
        getMyHTMLElement('overlayBox').style.display='none';
        if (window.sidebar){document.getElementById("overlayBox").style.MozOpacity=0;}
        if (document.all){document.getElementById("overlayBox").filters[0].opacity=0;}
   }
   if ( getMyHTMLElement('storePopup')!=null)
   {
        getMyHTMLElement('storePopup').style.display='none';
      
   }
   
    value = 0;
   
    //fadeTimer = "";
    }
*/

function chooseHomeTab(tab,maxtab){
    for (i=1;i<=maxtab;i++){
    getMyHTMLElement('hometab_' + i).className = '';
    getMyHTMLElement('homedesc_' + i).style.display = 'none';
    }
    getMyHTMLElement('hometab_' + tab).className = 'tabselected';
    getMyHTMLElement('homedesc_' + tab).style.display = '';

}

function emailValid(email) 
{
   var reg = /^[a-zA-Z0-9][a-zA-Z0-9-_\.]*@[a-zA-Z0-9-_]*\.[a-zA-Z0-9-_]*[a-zA-Z0-9-_\.]*[a-zA-Z0-9-_]$/;
   var result = 1;
   if(reg.test(email) == false) {result = 0}
   return result;
}

// Used for images in case no image server exists - DD
function lookupImage(myObj){
// This function checks to ensure that the image exists on the image server.
// If the site is using an image server and there is a connection fault, then this javascript function can revert back to the normal images
    // Find the image name without the path
    imageName = myObj.src
    imageNameArray = imageName.split("/")
    var imageNameNoPath = ""
        for (var i = 0;i<imageNameArray.length;i++){
            if (i>2){
            imageNameNoPath = imageNameNoPath + "/" + imageNameArray[i]
            }
        }
        
    // Test the image on the local system    
    myObj.src = imageNameNoPath
    var newImage = new Image();
    newImage.src =  imageNameNoPath
    // If the image does not exist on the local system then replace it with a spacer graphic
    newImage.onerror = function(msg, url, linenumber){
    //getMyHTMLElement(img_id).src = '/images/core/spacer.gif'
    myObj.src = '/images/core/spacer.gif'
    }
}
//-->


////////////////////////

function swapImage(imageName,imageFile){
	var swapImageName = eval('getMyHTMLElement(\'' + imageName + '\')');
	if (typeof(swapImageName) != 'undefined'){
		swapImageName.src = imageFile;
	}
} 

/* CHANGE IMAGE FUNCTIONS */

var imageArrayforSlide = [];

function createImageArray() {
	
	for (i=0; i<colourArray.length; i++) {
		
		if (colourArray[i].match('.swf') == null) {
			
			imageArrayforSlide.push(colourArray[i]);
			
		}
		
	}
	//alert(imageArrayforSlide);
}

function changeImage(imageName,transitionType,direction) {
	
	if (isSliding) {
		//alert('Already Sliding'); 
		return;
	}
	//Sudheer - Clear the array. Else keep appending.
	//imageArrayforSlide.clear();
	createImageArray();
	
	// set next & prev image variables
	var currentImage = getMyHTMLElement(imageName).src;
	//alert (getMyHTMLElement(imageName).src)
	
	for (i=0; i<imageArrayforSlide.length; i++) {
			
	   // alert('curr ' + currentImage);
	   // alert('martch curr ' + imageArrayforSlide[i].match(currentImage)); 		
/*		if (imageArrayforSlide[i].match(currentImage) == currentImage) {
			// if first image then set prev image to last in array so it loops, else prev image is previous in array
		//	alert('matched');
			if (i == 0) {
				prevImage = imageArrayforSlide[(imageArrayforSlide.length-1)];
				//prevImage_lge = largeArray[(largeArray.length-1)];
				}
			
			else {
				prevImage = imageArrayforSlide[(i-1)];
				//prevImage_lge = largeArray[(i-1)];
				}
			
			// if last image then set next image to first in array so it loops, else next image is next in array
			if (i == (imageArrayforSlide.length-1)) {
				nextImage = imageArrayforSlide[0];
				//nextImage_lge = largeArray[0];
				}
			
			else {
				nextImage = imageArrayforSlide[(i+1)];
				//nextImage_lge = largeArray[(i+1)];
			}
		}*/
	}
	
	///////////////////////////
var varStop = false;
var MaxCntr; 
var MinCntr;
var SelCntr = 0;
for (i=1; i<imageArrayforSlide.length + 1; i++) {
	//alert('length = ' + imageArrayforSlide.length);
	var currentImage = getMyHTMLElement(imageName).src;
	//alert('old image = ' + oldImage);
	//alert (currentImage);
    //alert(imageArrayforSlide);		
	MaxCntr = imageArrayforSlide.length;
	MinCntr = 1;
	
	
	/*if (i == MaxCntr && direction == 'next'){SelCntr = MinCntr; alert(1); varStop = true;}*/
	
	if (i == MinCntr && direction == 'prev') {
	    //alert(2);
	    if (oldImage == imageArrayforSlide[i -1])
	        {   //alert(2.1);
	            SelCntr = MaxCntr; 
	            varStop = true;
	        }
	    }
	
	if (SelCntr == 0 && direction == 'next') {	    
	    //alert(3); 
	    if (oldImage == imageArrayforSlide[i -1])
	    {
	        //alert(3.1); 
	        SelCntr = i+1;	        
	        varStop = true;
	    }    
	}
	
	if (SelCntr == 0 && direction == 'prev') {
	    //alert(4);
	    if (oldImage == imageArrayforSlide[i -1])
	    {
	        //alert(4.1);
	        SelCntr = i-1; 
	        varStop = true;
	    }
    }
	
	
	
	if (varStop) {i = imageArrayforSlide.length}
	
	//alert (imageArrayforSlide[SelCntr -1])
	//alert (imageArrayforSlide.length)
	//return false;
   	
	}

    if (direction == 'next') {
		imageFile = imageArrayforSlide[SelCntr -1];//nextImage;
		oldImage = imageFile;
		large_image_file_name = imageFile.replace('medium', 'large');
		xlarge_image_file = imageFile.replace('medium', 'large');
		}
	else if (direction == 'prev') {
	    //alert('disp prev now');
		imageFile = imageArrayforSlide[SelCntr -1]; //prevImage;
		oldImage = imageFile; // global variable for image zoom
		//large_image_file_name = prevImage_lge; //global variable for large image zoom
		large_image_file_name = imageFile.replace('medium', 'large');
		xlarge_image_file = imageFile.replace('medium', 'large');
		}
		//alert('image to display = ' + imageFile);
		//alert('large image = ' + large_image_file_name);	
		//alert('X large image = ' + xlarge_image_file);	
	///////////////////////////
	
	switch (transitionType) {
		
		case "fade":
			swapImageFade(imageName, imageFile);
			swapImage('large_img', large_image_file_name);
			setloadingimg(oldImage, large_image_file_name);
			break;
			
		case "swap":
			swapImage(imageName, imageFile);
			swapImage('large_img', large_image_file_name);
			setloadingimg(oldImage, large_image_file_name);
			break;
			
		case "slide":
		
			var container = 'productImageContainer';
			
			if (direction == 'next') {
				
				getMyHTMLElement('productImageTemp1').src = currentImage;
				getMyHTMLElement(container).style.left = '0px';
				
			}
			else if (direction == 'prev') {
				getMyHTMLElement('productImageTemp2').src = currentImage;
				getMyHTMLElement(container).style.left = '-700px';
			}
			
			swapImage(imageName, imageFile);
			swapImage('large_img', large_image_file_name);
			setloadingimg(oldImage, large_image_file_name);
				
			slideImage(direction, container, imageFile, 0);
				
			break;
	}
	
}


function capitalizeFirstLeter (data){

    data1 = strLeft(data,1);
    data1 = data1.toUpperCase();
    data2 = strRight(data,data.length - 1);
    data2 = data2.toLowerCase();
    return data1 + data2;

}

var slideImageTimeout;
var tempDirection;
var tempImageFile;
var tempContainer;
var tempPosition;
var isSliding = false;

function slideImage(direction, container, imageFile, position) {
	clearTimeout(slideImageTimeout);
	isSliding = false;
	var tempImg = new Image();
	
	tempImg.src = imageFile;
	
	tempDirection = direction;
	tempImageFile = imageFile;
	tempContainer = container;
	
	var increment = 10;
	var currentLeft = parseInt(getMyHTMLElement(container).style.left);
												
	if (!tempImg.complete) {
		tempPosition = position;
		slideImageTimeout = setTimeout("slideImage(tempDirection, tempContainer, tempImageFile, tempPosition)", 100);
	}
	else {
		
		if (position < 350) {
			isSliding = true;
			initialised = false; // disable zoom while sliding
			
			if (direction == 'next') {
				getMyHTMLElement(container).style.left = (currentLeft - increment) + 'px';
			}
			else if (direction == 'prev') {
				getMyHTMLElement(container).style.left = (currentLeft + increment) + 'px';	
			}
			
			position += increment;
			
			tempPosition = position;
			slideImageTimeout = setTimeout("slideImage(tempDirection, tempContainer, tempImageFile, tempPosition)", 20);
		}
		else {
			initialised = true; // enable zoom when finished sliding



		}
	}
	
	
}


function hidezoomonlightbox (){
	enable_zoom = false;	
}


function swapAltImageListings(imageID,imageFile,bulletNo,bulletMax){
swapImage('img'+imageID+'s',imageFile)
    for (var i=0; i<=bulletMax; i++) {
    swapImage('bullet_'+imageID+'_' + i,'/images/core/slide_bullet.png')
}
swapImage('bullet_'+imageID+'_' + bulletNo,'/images/core/slide_bullet2.png')
}

sfHover = function() {
//added condition use for only IE6
if (is_ie6==true) {
var sfEls = document.getElementById("drop").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
 	      sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
   	 }
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



////SHOW HIDE CAT DESC



<!--

function showhidecatdes(id){
	if (document.getElementById){
		obj = document.getElementById(id);
			if (obj.style.display == "none"){
				obj.style.display = "";
				document.getElementById("categoryDESCtitle").style.opacity = 1;
				document.getElementById("categoryDESCtitle").style.filter = 'alpha(opacity=' + 100 + ')';
				document.getElementById("categoryDESC").style.opacity = 1;
				document.getElementById("categoryDESC").style.filter = 'alpha(opacity=' + 100 + ')';
				document.getElementById('viewLink').innerHTML = "<img src='/images/core/viewless.gif' />";

			} else {
				obj.style.display = "none";
				document.getElementById("categoryDESCtitle").style.opacity = .8;
				document.getElementById("categoryDESCtitle").style.filter = 'alpha(opacity=' + 80 + ')';
				document.getElementById("categoryDESC").style.opacity = .8;
				document.getElementById("categoryDESC").style.filter = 'alpha(opacity=' + 80 + ')';
				document.getElementById('viewLink').innerHTML = "<img src='/images/core/viewmore.gif' />";


					}
			}
			
		} 
//--> 

<!--

function showhidecatdes2(id){
	if (document.getElementById){
		obj = document.getElementById(id);
			if (obj.style.display == "none"){
				obj.style.display = "";
						document.getElementById('viewLink').innerHTML = "<img src='/images/core/viewless.gif' border='0' />";
						

			} else {
				obj.style.display = "none";
						document.getElementById('viewLink').innerHTML = "<img src='/images/core/viewmore.gif' border='0' />";


					}
			}
			
		} 
//--> 

