/*	-------------------------------------------------------------
	function themeButton()
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Changes theme of page replacing image src
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function toggleTheme(theme) {
	 var imgs,i;
	 // replace images
	 imgs=document.getElementsByTagName('img');
	 for(i in imgs)
		 if(imgs[i].src!=null)
		 	if(imgs[i].src.indexOf("/buttons/")>-1) {
				imgs[i].src = imgs[i].src.replace("/buttons/","/buttons/"+theme+"/");
				imgs[i].src = imgs[i].src.replace("_lrg.gif",".gif");
				imgs[i].src = imgs[i].src.replace("_sml.gif",".gif");
				imgs[i].removeAttribute("width");
				imgs[i].removeAttribute("height");
			}
	  // replace images
	 imgs=document.getElementsByTagName('input');
	 for(i in imgs)
		 if(imgs[i].src!=null)
		 	if(imgs[i].src.indexOf("/buttons/")>-1) {
				imgs[i].src = imgs[i].src.replace("/buttons/","/buttons/"+theme+"/");
				imgs[i].src = imgs[i].src.replace("_lrg.gif",".gif");
				imgs[i].src = imgs[i].src.replace("_sml.gif",".gif");
				imgs[i].removeAttribute("width");
				imgs[i].removeAttribute("height");
			}
	}
/*	-------------------------------------------------------------
	function controlAlternateStyle()
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Handles css res dependent
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function controlAlternateStyle() {
		var i, a, w;
		w = window.screen.width;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(w<801&&a.href.indexOf("disabled")>-1)
				a.href = a.href.replace("disabled","lowres");
			else if(w>1024&&a.href.indexOf("disabled")>-1)
				a.href = a.href.replace("disabled","hires");
		}	
	}
	addEvent(window, 'load', controlAlternateStyle);
/*	-------------------------------------------------------------
	function addEvent(obj, type, fn)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Adds an event listener
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function addEvent( obj, type, fn ){ 
	   if (obj.addEventListener){ 
	      obj.addEventListener( type, fn, false );
	   }
	   else if (obj.attachEvent){ 
	      obj["e"+type+fn] = fn; 
	      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
	      obj.attachEvent( "on"+type, obj[type+fn] ); 
	   } 
	} 
/*	-------------------------------------------------------------
	function clearField(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Clears value of form object
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function clearField(obj,value) {
	if(obj.value==value)
		obj.value = '';
	}
	function resetField(obj,value) {
		if(obj.value=='')
			obj.value = value;
	}
/*	-------------------------------------------------------------
	function controlCoupon(obj,maxTotal,target)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Updates total cost when using coupon
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	var couponTotal = 0;
	function controlCoupon(obj,maxV,target) {
		var v = parseFloat(obj.value);
		var newV = 0.00;
		if (!isNaN(v)) {
		  if(v<maxV&&v>-1)
		  	newV = v;
		  else
		  	newV = maxV;	
		}
		/* set coupon value */
		obj.value = newV.toFixed(2);
		/* update total */		
		var target = document.getElementById(target);
		var total = target.innerHTML;
		/* remember orignal total */
		if(couponTotal==0)
			couponTotal = total;
		target.innerHTML = (couponTotal-newV).toFixed(2);
	}
	
/*	-------------------------------------------------------------
	function toggle(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Toggle object between hidden and not hidden
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function toggle(obj) {
		toggleClass(obj,'hidden')
	}
	
/*	-------------------------------------------------------------
	function toggleMultiple(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Shows an object and hides an object
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function toggleMultiple(objShow,objHide) {
		showObject(objShow);
		hideObject(objHide);
	}
/*	-------------------------------------------------------------
	function toggleTab(activeTab,noOfTabs)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Sets tab to visible and hides others
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/	
	function toggleTab(activeTab,noOfTabs) {
		for (i=1;i<=noOfTabs;i++) {
			if(i==activeTab) {
				removeClass("tab-"+i+"-plinth","hidden");
				addClass('tab-'+i+'-link','active');
			}
			else
			{
				addClass('tab-'+i+'-plinth','hidden');
				removeClass('tab-'+i+'-link','active');
			}
		}
	}
/*	-------------------------------------------------------------
	function addClass(obj,cssClass)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Adds class to object keeping current classes
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function addClass(obj,cssClass) {
		var object = document.getElementById(obj);
		var str = object.className;
		if(str.indexOf(cssClass)<0)
			str = str + " " + cssClass;
		object.className = str;
	}
/*	-------------------------------------------------------------
	function removeClass(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Removes class from object if exists
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function removeClass(obj,cssClass) {
		var object = document.getElementById(obj);
		var str = object.className;
		if(str.indexOf(cssClass)>-1)
			str = str.replace(cssClass,'');	
		object.className = str;
	}
/*	-------------------------------------------------------------
	function toggleClass(obj,cssClass)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Toggle class of object
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function toggleClass(obj,cssClass) {
		var object = document.getElementById(obj);
		var str = object.className;
		if(str.indexOf(cssClass)>-1)
			str = str.replace(cssClass,'');
		else
			str = str + " " + cssClass;
		object.className = str;
	}

/*	-------------------------------------------------------------
	function hideObject(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Sets objects class to hidden
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function hideObject(obj) {
		addClass(obj,'hidden')
	}

/*	-------------------------------------------------------------
	function showObject(obj)
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Removes class hidden from object
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function showObject(obj) {
		removeClass(obj,'hidden')
	}

/*	-------------------------------------------------------------
	function navSupport
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Suckerfish dropdown function
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	
	navSupport = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("nav-support");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload=navSupport;
/*	-------------------------------------------------------------
	function toggleImage
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	Description:	Change image src
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
	function toggleImage(obj,src) {
  	object = document.getElementById(obj);
		object.src = src; }
		
		
		
/* ---------------------------------------------------------------
	function possition floating div
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- -
	Description: position send to a friend floating div
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
	function getPosition(div){
	var thediv = document.getElementById(div);
	
	var scrollY;
      
      if (document.all)
      {     
         if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
         else
            scrollY = document.documentElement.scrollTop;
      }   
      else
      {
         scrollY = window.pageYOffset;
      }

		thediv.style.top = (scrollY+20)+"px";
		thediv.style.left = (document.body.offsetWidth/2)+"px";

}
	