// create DOM flag
var DOM=(document.getElementById) ? true : false;

/** used to show/hide divs**/
function layerswap(){
	if(!DOM){return;}
	var lyr = arguments[0];
	var start = arguments[2];
	var end = arguments[3];
	for(i = start; i < end; i++){
	    	document.getElementById(lyr + i).style.visibility="hidden";
		}
	document.getElementById(lyr + arguments[1]).style.visibility="visible";
}
/*************************/

// show layer based on which toothbrush called the page
function showlayer(page,pagereferrer){
	if (page == "" || page > 20 || page == 0){
		if (pagereferrer == "power") {page = 4;}
		else {page = 20;}
	}
document.getElementById("lyr-"+page).style.visibility="visible";
}

//  when page first loads dont allow the user to link to anything  (home page only)
// this same function is also used to control where the image map links to
function showimagemap(url){
	document.getElementById('image-map').style.visibility="visible";
	var linkis = document.getElementById('linkto1');
	linkis.href = url;
}


// compute number of items selected
function checkbox_checker(){
var checkbox_choices = 0;
for (counter = 0; counter < document.compare.Product.length; counter++){
	if (document.compare.Product[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }

}
return checkbox_choices;
}

// dont allow more than 3 selections.
function check_max(){
	if (checkbox_checker() > 3 ){
		document.getElementById('error').style.visibility="visible";
		document.getElementById('error_submit').style.visibility="hidden";
		return (false);
	}else{
		document.getElementById('error').style.visibility="hidden";
		document.getElementById('error_submit').style.visibility="hidden";
		return true;
	}
}

// display message and dont allow submit if no selections have been made.
function check_min(){
if (checkbox_checker() == 0 ){
	document.getElementById('error_submit').style.visibility="visible";
	return (false);
	}else{document.compare.submit(); return true;}
}


/** DOM rollovers **/
function swapImage(){
	if(!DOM){return;}
	for(i=0; i < arguments.length; i++){
		document.getElementById(arguments[i]).setAttribute('src',arguments[++i]);
	} 
}
/*************************/

/** popper **/
function Pop(URL,winName,popW,popH){
	// set window parameters
	var winStats='toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=no,width='+popW+',height='+popH+',';
	if(navigator.appName.indexOf("Microsoft")>=0){winStats+='left=75,top=50';}
	else{winStats+='screenX=75,screenY=50';}
	var mainWindow=window.open(URL,winName,winStats);
}

/*************************/

/** queue up rollover images for navs **/

// power page image pre loads
	box400off = new Image();
	box400off.src = "images/power/box_400_off.gif";
	box400on = new Image();
	box400on.src = "images/power/box_400_on.gif";
	
	box5000off = new Image();
	box5000off.src = "images/power/box_5000_off.gif";
	box5000on = new Image();
	box5000on.src = "images/power/box_5000_on.gif";

	box7000off = new Image();
	box7000off.src = "images/power/box_7000_off.gif";
	box7000on = new Image();
	box7000on.src = "images/power/box_7000_on.gif";

	box8000off = new Image();
	box8000off.src = "images/power/box_8000_off.gif";
	box8000on = new Image();
	box8000on.src = "images/power/box_8000_on.gif";

	box900off = new Image();
	box900off.src = "/uk/images/power/box_900_off.gif";
	box900on = new Image();
	box900on.src = "/uk/images/power/box_900_on.gif";

	boxcapoweroff = new Image();
	boxcapoweroff.src = "images/power/box_ca_power_off.gif";
	boxcapoweron = new Image();
	boxcapoweron.src = "images/power/box_ca_power_on.gif";

	boxkidsoff = new Image();
	boxkidsoff.src = "/uk/images/power/box_kids_off.gif";
	boxkidson = new Image();
	boxkidson.src = "/uk/images/power/box_kids_on.gif";
	
	boxpowermaxoff = new Image();
	boxpowermaxoff.src = "images/power/box_powermax_off.gif";
	boxpowermaxon = new Image();
	boxpowermaxon.src = "images/power/box_powermax_on.gif";

	boxsonicoff = new Image();
	boxsonicoff.src = "images/power/box_sonic_off.gif";
	boxsonicon = new Image();
	boxsonicon.src = "images/power/box_sonic_on.gif";
	
	advancepower900off = new Image();
	advancepower900off.src = "images/power/box_advancepower900_off.gif";
	advancepower900on = new Image();
	advancepower900on.src = "images/power/box_advancepower900_on.gif";
	
	vitalitywhitecleanoff = new Image();
	vitalitywhitecleanoff.src = "images/power/box_VitalityWhiteClean_off.gif";
	vitalitywhitecleanon = new Image();
	vitalitywhitecleanon.src = "images/power/box_VitalityWhiteClean_on.gif";
	
	vitalitysensitiveoff = new Image();
	vitalitysensitiveoff.src = "images/power/box_VitalitySensitive_off.gif";
	vitalitysensitiveon = new Image();
	vitalitysensitiveon.src = "images/power/box_VitalitySensitive_on.gif";
	
	procare6000off = new Image();
	procare6000off.src = "images/power/box_procare6000_off.gif";
	procare6000on = new Image();
	procare6000on.src = "images/power/box_procare6000_on.gif";
	
	procare8000off = new Image();
	procare8000off.src = "images/power/box_procare8000_off.gif";
	procare8000on = new Image();
	procare8000on.src = "images/power/box_procare8000_on.gif";
	
	procare8500off = new Image();
	procare8500off.src = "images/power/box_procare8500_off.gif";
	procare8500on = new Image();
	procare8500on.src = "images/power/box_procare8500_on.gif";
	
	procare8900off = new Image();
	procare8900off.src = "images/power/box_procare8900_off.gif";
	procare8900on = new Image();
	procare8900on.src = "images/power/box_procare8900_on.gif";
	
	triumphoff = new Image();
	triumphoff.src = "images/power/boxsmg_off.gif";
	triumphon = new Image();
	triumphon.src = "images/power/boxsmg_on.gif";
	
// manual page image pre loads
	boxarticaoff = new Image();
	boxarticaoff.src = "images/manual/box_artica_off.gif";
	boxarticaon = new Image();
	boxarticaon.src = "images/manual/box_artica_on.gif";

	boxcontroloff = new Image();
	boxcontroloff.src = "images/manual/box_control_off.gif";
	boxcontrolon = new Image();
	boxcontrolon.src = "images/manual/box_control_on.gif";

	boxcrossactoff = new Image();
	boxcrossactoff.src = "images/manual/box_crossact_off.gif";
	boxcrossacton = new Image();
	boxcrossacton.src = "images/manual/box_crossact_on.gif";

	boxindicatoroff = new Image();
	boxindicatoroff.src = "images/manual/box_indicator_off.gif";
	boxindicatoron = new Image();
	boxindicatoron.src = "images/manual/box_indicator_on.gif";

	boxplusoff = new Image();
	boxplusoff.src = "images/manual/box_plus_off.gif";
	boxpluson = new Image();
	boxpluson.src = "images/manual/box_plus_on.gif";

	boxstage1off = new Image();
	boxstage1off.src = "images/manual/box_stage1_off.gif";
	boxstage1on = new Image();
	boxstage1on.src = "images/manual/box_stage1_on.gif";

	boxstage2off = new Image();
	boxstage2off.src = "images/manual/box_stage2_off.gif";
	boxstage2on = new Image();
	boxstage2on.src = "images/manual/box_stage2_on.gif";
	
	boxstage3off = new Image();
	boxstage3off.src = "images/manual/box_stage3_off.gif";
	boxstage3on = new Image();
	boxstage3on.src = "images/manual/box_stage3_on.gif";
	
	boxstage4off = new Image();
	boxstage4off.src = "images/manual/box_stage4_off.gif";
	boxstage4on = new Image();
	boxstage4on.src = "images/manual/box_stage4_on.gif";

	boxcrossectionoff = new Image();
	boxcrossectionoff.src = "images/manual/box_crossection_off.gif";
	boxcrossection = new Image();
	boxcrossection.src = "images/manual/box_crossection_on.gif";
	
	boxvitalizeoff = new Image();
	boxvitalizeoff.src = "images/manual/box_vitalize_off.gif";
	boxvitalizeon = new Image();
	boxvitalizeon.src = "images/manual/box_vitalize_on.gif";
	
	pulsaroff = new Image();
	pulsaroff.src = "images/manual/box_pulsar_off.gif";
	pulsaron = new Image();
	pulsaron.src = "images/manual/box_pulsar_on.gif";	
	
	advantagesensitiveoff = new Image();
	advantagesensitiveoff.src = "images/manual/box_advantagesensitive_off.gif";
	advantagesensitiveon = new Image();
	advantagesensitiveon.src = "images/manual/box_advantagesensitive_on.gif";	
	
	pulsarprohealthoff = new Image();
	pulsarprohealthoff.src = "images/manual/box_pulsarprohealth_off.gif";
	pulsarprohealthon = new Image();
	pulsarprohealthon.src = "images/manual/box_pulsarprohealth_on.gif";
	
	indicatordeepcleanoff = new Image();
	indicatordeepcleanoff.src = "images/manual/box_indicatordeepclean_off.gif";
	indicatordeepcleanon = new Image();
	indicatordeepcleanon.src = "images/manual/box_indicatordeepclean_on.gif";
	
	advantageglide_advancecleanoff = new Image();
	advantageglide_advancecleanoff.src = "images/manual/box_advantageglide_advanceclean_off.gif";
	advantageglide_advancecleanon = new Image();
	advantageglide_advancecleanon.src = "images/manual/box_advantageglide_advanceclean_on.gif";
	
	advantageglide_gumcareoff = new Image();
	advantageglide_gumcareoff.src = "images/manual/box_advantageglide_gumcare_off.gif";
	advantageglide_gumcareon = new Image();
	advantageglide_gumcareon.src = "images/manual/box_advantageglide_gumcare_on.gif";
	
	advantageglide_whiteningoff = new Image();
	advantageglide_whiteningoff.src = "images/manual/box_advantageglide_whitening_off.gif";
	advantageglide_whiteningon = new Image();
	advantageglide_whiteningon.src = "images/manual/box_advantageglide_whitening_on.gif";
	
	advantageglide_sensitouchoff = new Image();
	advantageglide_sensitouchoff.src = "images/manual/box_advantageglide_sensitouch_off.gif";
	advantageglide_sensitouchon = new Image();
	advantageglide_sensitouchon.src = "images/manual/box_advantageglide_sensitouch_on.gif";
	
	advantagebreathrefreshoff = new Image();
	advantagebreathrefreshoff.src = "images/manual/box_advantagebreathrefresh_off.gif";
	advantagebreathrefreshon = new Image();
	advantagebreathrefreshon.src = "images/manual/box_advantagebreathrefresh_on.gif";
	
	d25off = new Image();
	d25off.src = "images/power/box_d25_off.gif";
	d25on = new Image();
	d25on.src = "images/power/box_d25_on.gif";		

	boxsmgoff = new Image();
	boxsmgoff.src = "images/power/boxsmg_off.gif";
	boxsmgon = new Image();
	boxsmgon.src = "images/power/boxsmg_on.gif";			
	
	boxclassiccareoff = new Image();
	boxclassiccareoff.src = "images/manual/box_classiccare_off.gif";
	boxclassiccareon = new Image();
	boxclassiccareon.src = "images/manual/box_classiccare_on.gif";
	
	boxadvantage123off = new Image();
	boxadvantage123off.src = "images/manual/box_advantage123_off.gif";
	boxadvantage123on = new Image();
	boxadvantage123on.src = "images/manual/box_advantage123_on.gif";
	
	boxprecisionoff = new Image();
	boxprecisionoff.src = "images/power/box_vitalityprecision_off.gif";
	boxprecisionon = new Image();
	boxprecisionon.src = "images/power/box_vitalityprecision_on.gif";	
	
	boxdualoff = new Image();
	boxdualoff.src = "images/power/box_vitalitydual_off.gif";
	boxdualon = new Image();
	boxdualon.src = "images/power/box_vitalitydual_on.gif";	
	
	boxsonic_Voff = new Image();
	boxsonic_Voff.src = "images/power/box_vitalitysonic_off.gif";
	boxsonic_Von = new Image();
	boxsonic_Von.src = "images/power/box_vitalitysonic_on.gif";	
	
	
	
/*****************************************************/
/*          home page image preloads                 */

	flossoff = new Image();
	flossoff.src = "/uk/images/home/button_floss_off.gif";
	flosson = new Image();
	flosson.src = "/uk/images/home/button_floss_on.gif";

	gooff = new Image();
	gooff.src = "/uk/images/home/button_go_off.gif";
	goon = new Image();
	goon.src = "/uk/images/home/button_go_on.gif";

	manualoff = new Image();
	manualoff.src = "/uk/images/home/button_manual_off.gif";
	manualon = new Image();
	manualon.src = "/uk/images/home/button_manual_on.gif";

	poweroff = new Image();
	poweroff.src = "/uk/images/home/button_power_off.gif";
	poweron = new Image();
	poweron.src = "/uk/images/home/button_power_on.gif";

	
	toothpasteoff = new Image();
	toothpasteoff.src = "/uk/images/home/button_toothpaste_off.gif";
	toothpasteon = new Image();
	toothpasteon.src = "/uk/images/home/button_toothpaste_on.gif";

	kidsoff = new Image();
	kidsoff.src = "/uk/images/home/button_kids_off.jpg";
	kidson = new Image();
	kidson.src = "/uk/images/home/button_kids_on.jpg";
	
	pbushheadoff = new Image();
	pbushheadoff.src = "/uk/images/home/button_pbrushhead_on.jpg";
	pbushheadon = new Image();
	pbushheadon.src = "/uk/images/home/button_pbrushhead_off.jpg";
	
	stagespoweroff = new Image();
	stagespoweroff.src = "/uk/products/compare/images/power/box_stagespower_off.gif";
	stagespoweron = new Image();
	stagespoweron.src = "/uk/products/compare/images/power/box_stagespower_on.gif";
	

