// JavaScript Document
  
//Disable select-text script (IE4+, NS6+)- By Andy Scott
//Exclusive permission granted to Dynamic Drive to feature script
//Visit http://www.dynamicdrive.com for this script 
  
function disableselect(e){
return false
} 
  
function reEnable(){
return true
} 
  
//if IE4+
document.onselectstart=new Function ("return false") 
  
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}


//Prevent right-click/copy of images

function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("I'm sorry, The Right click option on your mouse has been disabled for the download window pages.");
return false;
}
return true;
} 
  
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function bookmarksite(title, url, name){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function viewDiv(tabname, divname)
{
	var objTab = FIND(tabname);
	if (!objTab) return;
	var objDiv = FIND(divname);
	if (!objDiv) return;
	
	hideDiv(); 
	
	objTab.style.backgroundColor = "#ddddff";
	objTab.style.borderBottom = "none";
	objDiv.style.visibility = "visible";

	
	/* Save menu object for future reference. */
	window.ActiveTab = objTab;	
	window.ActiveDiv = objDiv;
}

function hideDiv()
{
	var menu = window.ActiveDiv;
	if (menu)
	  menu.style.visibility = "hidden";
	
	var category = window.ActiveTab;
	if (category)
	{
		category.style.backgroundColor = "#FFFFFF";
		category.style.borderBottom = "1px solid #003399";
	}
}

/* Utility functions */
function FIND(item) {
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}
function GetParam(name)
{
  var start=location.search.indexOf("?"+name+"=");
  if (start<0) start=location.search.indexOf("&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  var end=location.search.indexOf("&",start)-1;
  if (end<0) end=location.search.length;
  var result=location.search.substring(start,end);
  var result='';
  for(var i=start;i<=end;i++) {
    var c=location.search.charAt(i);
    result=result+(c=='+'?' ':c);
  }
  return unescape(result);
}

function WriteLink(name, which, productid)
{
	var dist;
	/* Get distributor # from parm list if available. Otherwise set default distributor */
	if (GetParam(name) == '')
	  dist = "536861"; /* Set default distributor when not given */
	else
	  dist = GetParam(name);
	
	/* Write dist # into link to buy product or to join link */
	if (which == "buy")
	   document.write('<a href="http://shop.waiora.com/myProducts.php?d='+dist+'&i='+productid+'" target="_blank"> ');
	else /* "join" */
	   document.write('<a href="http://shop.waiora.com/join/step01US.php?'+dist+'" target="_blank"> ');
}
