/****************************************************************************/
/***		Client-side JavaScript function library														***/
/***		Copyright Apache Solutions Ltd 2005																***/
/***		(unauthorised use of this code will result in prosecution by law)	***/
/****************************************************************************/

// define the main menu hotspot images and their alternatives.
if (document.images) {
	ft_hot01off = new Image(100,14);
  ft_hot01off.src = "../images/footer/back_to_topa.gif";
  ft_hot01on = new Image(100,14);
 	ft_hot01on.src = "../images/footer/back_to_topb.gif";
	
	m_hot01off = new Image(138,16);
  m_hot01off.src = "../images/menu/menu_home_a.gif";
  m_hot01on = new Image(138,16);
 	m_hot01on.src = "../images/menu/menu_home_b.gif";
	
	m_hot02off = new Image(138,37);
  m_hot02off.src = "../images/menu/menu_berio_a.gif";
  m_hot02on = new Image(138,37);
 	m_hot02on.src = "../images/menu/menu_berio_b.gif";
	
	m_hot03off = new Image(138,16);
  m_hot03off.src = "../images/menu/menu_oil_a.gif";
  m_hot03on = new Image(138,16);
 	m_hot03on.src = "../images/menu/menu_oil_b.gif";
	
	m_hot04off = new Image(138,16);
  m_hot04off.src = "../images/menu/menu_health_a.gif";
  m_hot04on = new Image(138,16);
 	m_hot04on.src = "../images/menu/menu_health_b.gif";
	
	m_hot05off = new Image(138,16);
  m_hot05off.src = "../images/menu/menu_products_a.gif";
  m_hot05on = new Image(138,16);
 	m_hot05on.src = "../images/menu/menu_products_b.gif";
	
	m_hot06off = new Image(138,37);
  m_hot06off.src = "../images/menu/menu_choosing_a.gif";
  m_hot06on = new Image(138,37);
 	m_hot06on.src = "../images/menu/menu_choosing_b.gif";
	
	m_hot07off = new Image(138,16);
  m_hot07off.src = "../images/menu/menu_recipes_a.gif";
  m_hot07on = new Image(138,16);
 	m_hot07on.src = "../images/menu/menu_recipes_b.gif";
	
	m_hot08off = new Image(138,16);
  m_hot08off.src = "../images/menu/menu_competitions_a.gif";
  m_hot08on = new Image(138,16);
 	m_hot08on.src = "../images/menu/menu_competitions_b.gif";
	
	m_hot09off = new Image(138,16);
  m_hot09off.src = "../images/menu/menu_offers_a.gif";
  m_hot09on = new Image(138,16);
 	m_hot09on.src = "../images/menu/menu_offers_b.gif";
	
	m_hot10off = new Image(138,16);
  m_hot10off.src = "../images/menu/menu_new_a.gif";
  m_hot10on = new Image(138,16);
 	m_hot10on.src = "../images/menu/menu_new_b.gif";
	
	m_hot11off = new Image(138,16);
  m_hot11off.src = "../images/menu/menu_contact_a.gif";
  m_hot11on = new Image(138,16);
 	m_hot11on.src = "../images/menu/menu_contact_b.gif";
	
	m_hot12off = new Image(138,16);
  m_hot12off.src = "../images/menu/menu_my_berio_a.gif";
  m_hot12on = new Image(138,16);
 	m_hot12on.src = "../images/menu/menu_my_berio_b.gif";
	
	m_hot13off = new Image(138,32);
  m_hot13off.src = "../images/menu/menu_my_berio_reg_a.gif";
  m_hot13on = new Image(138,32);
 	m_hot13on.src = "../images/menu/menu_my_berio_reg_b.gif";
	
	m_hot14off = new Image(138,32);
  m_hot14off.src = "../images/menu/menu_promotions_a.gif";
  m_hot14on = new Image(138,32);
 	m_hot14on.src = "../images/menu/menu_promotions_b.gif";
	
	m_hot15off = new Image(138,32);
  m_hot15off.src = "../images/menu/menu_newsletter_a.gif";
  m_hot15on = new Image(138,32);
 	m_hot15on.src = "../images/menu/menu_newsletter_b.gif";
	
	m_hot16off = new Image(138,32);
  m_hot16off.src = "../images/menu/menu_faqs_a.gif";
  m_hot16on = new Image(138,32);
 	m_hot16on.src = "../images/menu/menu_faqs_b.gif";
	
	m_hot17off = new Image(138,18);
  m_hot17off.src = "../images/menu/menu_video_recipes_a.gif";
  m_hot17on = new Image(138,18);
 	m_hot17on.src = "../images/menu/menu_video_recipes_b.gif";
	
	tvadoff = new Image(168,100);
  tvadoff.src = "../images/header/tv_ad_a.jpg";
  tvadon = new Image(168,100);
 	tvadon.src = "../images/header/tv_ad_b.jpg";
	
	danilotipsoff = new Image(117,51);
  danilotipsoff.src = "../images/header/danilo-tips_a.jpg";
  danilotipson = new Image(117,51);
 	danilotipson.src = "../images/header/danilo-tips_b.jpg";
	
	danilorecipesoff = new Image(117,49);
  danilorecipesoff.src = "../images/header/danilo-recipes_a.jpg";
  danilorecipeson = new Image(117,49);
 	danilorecipeson.src = "../images/header/danilo-recipes_b.jpg";
	
	chefoff = new Image(96,105);
  chefoff.src = "../images/header/chef_a.jpg";
  chefon = new Image(96,105);
 	chefon.src = "../images/header/chef_b.jpg";
	
	sprayoff = new Image(110,110);
  sprayoff.src = "../images/header/spray_a.gif";
  sprayon = new Image(110,110);
 	sprayon.src = "../images/header/spray_b.gif";
	
	expressoff = new Image(139,139);
  expressoff.src = "../images/logos/express_a.jpg";
  expresson = new Image(139,139);
 	expresson.src = "../images/logos/express_b.jpg";
	
	citaliaoff = new Image(139,103);
  citaliaoff.src = "../images/logos/citalia_a.jpg";
  citaliaon = new Image(139,103);
 	citaliaon.src = "../images/logos/citalia_b.jpg";
}

//
//	Returns true if the given variable is blank:
//
function IsBlank(value) {
	// cast to string.
	var str = "" + value;
	return ((str == "") || (str == " ") || (str == "undefined") || (str == "null") || (str == null));
}

//
//	Returns true if browser is Internet Explorer:
//
function IsIE() {
	return (window.navigator.userAgent.indexOf("MSIE") >= 1);
}

//
// Sets the roll-in image:
//
//	N.B the 'on_name' param is optional - it overrides the default value of 'on' for the active image object.
//
function RollIn(img_name, on_name) {
	if (document.images) {
		var the_on_name = (IsBlank(on_name) ? 'on.src':on_name+'.src');
		document[img_name].src=eval(img_name + the_on_name);             
	}
	return true;
}
//
// Sets the roll-out image:
//
function RollOut(img_name) {
	if (document.images) {
		document[img_name].src=eval(img_name + "off.src");          
	}
	return true;
}

//
// Sets the on click image:
//
function RollClick(img_name) {
	if (document.images) {
		document[img_name].src=eval(img_name + "click.src");          
	}
	return true;
}

//
// Sets the roll-in form image:
//
function RollInFormImage(img_name) {
	document.all[img_name].src=eval(img_name + "on.src");           
}

//
// Sets the roll-out form image:
//
function RollOutFormImage(img_name) {
	document.all[img_name].src=eval(img_name + "off.src");   
}

//
// Sets the on click form image:
//
function RollClickFormImage(img_name) {
	document.all[img_name].src=eval(img_name + "click.src");   
}

//
//	Opens the popup window.
//
function OpenPopupWindow(url, win_width, win_height) {
	var popupwindow = window.open(url, 'popupwindow', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width='+win_width+',height='+win_height);
	popupwindow.focus();
}


function embedFlashObject(url, width, height, flashVars) {
	var html = 
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '">' +
			'<param name="allowScriptAccess" value="sameDomain" />' +
			'<param name="movie" value="' + url + '" />' +
			'<param name="quality" value="high" />' +
			'<param name="bgcolor" value="#FFF" />' +
			'<param name="wmode" value="transparent" />' +
			((flashVars) ? ('<param name="FlashVars" value="' + flashVars + '" />') : '') +
			'<embed src="' + url + '"' + ((flashVars) ? (' flashvars="' + flashVars + '"') : '') + ' quality="high" wmode="transparent" bgcolor="#FFF" width="' + width + '" height="' + height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
		'</object>';
	document.write(html);
}
