/**
 * Global Values
 * 
 * imgDefPath		=>	Image path to default images
 * MenuImageArr		=>	Array of image names for preloading
 **/
var imgDefPath = '/_images/default/';
var imgPath = '/_images/';
var imgBtnPath = 'buttons/'
var MenuImageArr = Array('healthylife', 'health', 'shop', 'dispensaries');


/**
 * This function make the rollover effect and show the submenu
 *
 * @access public
 * @param ID (example: 1)
 * @param name (example: shop)
 * @param opt (example: over)
 * @param onlyShowSubmenu (0 or 1)
 * @return void
 **/
function menuChangePic(ID, name ,opt, onlyShowSubmenu) {
	
	try {
		if(onlyShowSubmenu!=1) {
			document.getElementById('menu'+ID).src = imgDefPath + 'menu_' + name + '_' + opt + '.gif';
		}	
		
		if(opt=='over') {
			document.getElementById('menu'+ID+'sub').style.display = 'block';
		} else {
			document.getElementById('menu'+ID+'sub').style.display = 'none';
		}
	} catch(e) {}
		
}


/**
 * This function preload the rollover Images
 *
 * @access public
 * @return void
 **/
function preload() {
	
  for (i=0; i < MenuImageArr.length; i++) {
	var PImage = new Image();
	PImage.src = imgDefPath + 'menu_' + MenuImageArr[i] + '_over.gif';
  }
}


/**
 * This function change the Class of a object
 *
 * @access public
 * @param the object which has to be hidden
 * @return void
 **/
function changeClass(element,clName) {
	element.className = clName;
}


/**
 * This function change the Image of a RollOver Button
 *
 * @access public
 * @param id of the image
 * @return void
 **/
function btnRollOver(ID,color,opt) {
	try {
		if(opt=='rollover') {
			document.getElementById(ID).src = imgPath + color + '/' + imgBtnPath + 'btn_' + opt + '_' + ID + '.gif';
		} else {
			document.getElementById(ID).src = imgPath + color + '/' + imgBtnPath + 'btn_' + ID + '.gif';
		}
	} catch(e) {}
}

/**
 * This function change the Image of a RollOver Button
 *
 * @access public
 * @param id of the image
 * @return void
 **/
function btnRollOver(ID,color,btn,opt) {
	try {
		if(opt=='rollover') {
			document.getElementById(ID).src = imgPath + color + '/' + imgBtnPath + 'btn_' + opt + '_' + btn + '.gif';
		} else {
			document.getElementById(ID).src = imgPath + color + '/' + imgBtnPath + 'btn_' + btn + '.gif';
		}
	} catch(e) {}
}


/**
 * Start Preloading Images
 **/
preload();


/**
 * Check for cookie activation
**/
function readtestcookie() {
        var theCookie=""+document.cookie;
        var ind=theCookie.indexOf("apotestcookie");
        if (ind==-1) return "";
          return "1";
}

function settestcookie() {
        document.cookie = "apotestcookie=1";
}