
function Print()
{
	if (window.print) window.print();
}

function OnChangeCigCompSection(evt)
{
	if (document.getElementById("ddlCountryCC").selectedIndex != 0) 
	{
		window.location.href="/pages/home/default.aspx?Section=1&SelectedItem=" + document.getElementById("ddlCountryCC").options[document.getElementById("ddlCountryCC").selectedIndex].text + "&SelectedIndex=" + document.getElementById("ddlCountryCC").selectedIndex;
	}

}

function OnChangeSmokeConstSection(evt)
{
	if (document.getElementById("ddlCountrySC").selectedIndex != 0) 
	{
		window.location.href="/pages/home/default.aspx?Section=0&SelectedItem=" + document.getElementById("ddlCountrySC").options[document.getElementById("ddlCountrySC").selectedIndex].text + "&SelectedIndex=" + document.getElementById("ddlCountrySC").selectedIndex;
	}

}

function ComponentChanged()
{
	if (document.getElementById("ddlcomponentlist").selectedIndex != 0) 
	{
		document.Form1.submit();
	}
	document.getElementById("ddlcomponentlist").selectedIndex=0;

}

function resetDllComponents()

{
	if (document.getElementById("ddlcomponentlist") != null)
	{	

		document.getElementById("ddlcomponentlist").selectedIndex = 0;
	}

}



function isCountrySelectedCigCompSection(errorMessage,evt)
{
	if (document.getElementById("ddlCountryCC").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessage);
		e.returnValue=false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isCountrySelectedSmokeConstSection(errorMessage,evt)
{
	if (document.getElementById("ddlCountrySC").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessage);
		e.returnValue=false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isCountrySelected(errorMessage,evt)
{
	if (document.getElementById("ddlcountry").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessage);
        e.returnValue = false; 
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isToShowPrinterFriendlyList(countryErrorMessage,isAnyImageMapSet,evt)
{
	if (document.getElementById("ddlcountry").selectedIndex == 0) 
	{
		var e = (window.event) ? window.event : evt;
		alert(countryErrorMessage);
		e.returnValue = false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isBrandSelected(errorMessage,evt)
{
	if (document.getElementById("ddlbrandfamily").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessage);
		e.returnValue=false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isVariantSelected(errorMessage,evt)
{
	if (document.getElementById("ddlbrandvariants").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessage);
		e.returnValue=false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}
function isComponentSelected(errorMessageComponent,errorMessageCountry,evt)
{
	if (document.getElementById("ddlcountry").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessageCountry);
		e.returnValue=false;
	}
	else if (document.getElementById("ddlcomponentlist").selectedIndex == 0) 
	{
		var e= (window.event) ? window.event : evt;
		alert(errorMessageComponent);
		e.returnValue=false;
	}
	if (navigator.userAgent.indexOf('Opera') != -1)
	{
		return e.returnValue;	
	}
}



function BrandLogoSelected(LogoIndexClicked)
{
	document.Form1.hdnimageindex.value=LogoIndexClicked;
	document.Form1.submit();
	
}
/*function RedirectToPage(componentName)
{
	document.Form1.hdncomponentname.value=componentName;
	document.Form1.submit();
	
}
*/			
function CountryChangedClientSide()
{
	if (document.getElementById("lblselectbrandon") != null)
		document.getElementById("lblselectbrandon").className  = "label_bullet3_off";
	
	ClearOptions(document.getElementById("ddlbrandfamily"),true);
	document.getElementById("ddlbrandfamily").disabled=true;
	document.getElementById("btnbrandgo").src="/global/images/buttons/button_go_41_off.gif";
	document.getElementById("btnbrandgo").disabled=true;
	
	CommonChanges();
	
	/*if (document.Form1.isvariantinfodisplayed.value == "true")
	{
		document.Form1.hdnreverttonewcountrylevel.value="true";
	}*/
	document.Form1.hdnreverttonewcountrylevel.value="true";
	document.Form1.submit();  // need to re-load the page to reset the image maps
	//window.location.href="../../global/scripts/InternalLink.aspx?RedirectUrl=../../aspx/country.aspx&CountryName=" + document.getElementById("ddlcountry").options[document.getElementById("ddlcountry").selectedIndex].text;
}
function CommonChanges()
{
	if (document.getElementById("lblselectlogoon") != null)
		document.getElementById("lblselectlogoon").className  = "label_bullet2_off";
		
	if (document.getElementById("brandlogodisplayarea") != null)
	{
		document.getElementById("brandlogodisplayarea").innerHTML ="";
		document.getElementById("brandlogodisplayarea").style.display="none";
	}
	if(document.getElementById("lblhealthwarningdisplayarea") != null)
	{
		document.getElementById("lblhealthwarningdisplayarea").innerHTML ="";
		document.getElementById("lblhealthwarningdisplayarea").style.display="none";
	}
	if (document.getElementById("lblvarianton") != null)
		document.getElementById("lblvarianton").className  = "label_bullet3_off"; 
	ClearOptions(document.getElementById("ddlbrandvariants"),false);
	document.getElementById("ddlbrandvariants").disabled=true;
	document.getElementById("btnvariantgo").src = "/global/images/buttons/button_go_41_off.gif";
	document.getElementById("btnvariantgo").disabled=true;
}
function BrandFamilyChangedClientSide()
{
	CommonChanges();
	
	if (document.Form1.isvariantinfodisplayed.value == "true")
	{
		document.Form1.hdnreverttonewbrandlevel.value="true";
		document.Form1.submit();  
	}
	else
	{	
		document.Form1.hdnreverttonewbrandlevel.value="true";
		document.Form1.submit(); 
	}
}
function VariantChangedClientSide()
{
	document.Form1.isvariantinfodisplayed.value = "true";
	if (document.Form1.isvariantinfodisplayed.value == "true")
	{
		document.Form1.hdnreverttonewvariantlevel.value="true";
		document.Form1.submit();  
	}		
}
function ClearOptions(OptionList,bVal) 
{
	// Always clear an option list from the last entry to the first
	for (x = OptionList.length; x >= 0; x = x - 1)
	{
	OptionList[x] = null;
	}
	if (bVal == true)
	{
		OptionList.options[0] = new Option("Select a brand");
	}
	else
	{
		OptionList.options[0] = new Option("Select a pack style");
	}
}

var bVal = 0;
if(bVal) 
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
	return false;
}
function mousehandler(e){
var myevent = (bVal) ? e : event;
var eventbutton = (bVal) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
function keyhandler(e) {
var myevent = (bVal) ? e : window.event;
return;
}
document.oncontextmenu = mischandler;
document.onkeypress = keyhandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;