function logout(){
msg = window.confirm('Are you sure that you want to Log Out of Customer Zone? Click Ok for Yes or Cancel for No.')
       
   if( msg == 0);
else {
window.location.href="/nielsen/web.nsf/home!LogOut&RedirectTo=/nielsen/web.nsf/home";}    
}
function logIn() {
var userName = $('#username').val();
var passWord = $('#password').val();
	if ( userName =="" || passWord  == '') {
	alert("Please enter you Username/Password");
	return false;
	} 
};


$(document).ready(function() {
/* Attach OnChange to home page stockist country drop down*/
$('#stockist_country').change(function() {
  $('#stockist_postcode').val("");
});
/* Attach OnClick to Home Page Stockist Submit Button*/
  $('#submit-stockist').click(function() {
	//var country = $('#stockist_country').val();
	var postcode = $('#stockist_postcode').val();
	//if(country  == "United Kingdom"){
		//if(postcode.length == 0 ){
		//location.href= 'http://www.nielsenchemicals.com/nielsen/web.nsf/pages/stockist!open&country='+country 
		//return false;
		//}
		if(postcode.length < 2 ){
		alert("Please enter a post code of at least 2 characters");
		return false;
		}
		else{
		location.href= '/nielsen/web.nsf/pages/stockist!open&postcode='+postcode.toUpperCase();
		return false;
		}
	//}
	//else if(country  != "United Kingdom"){
	//location.href= 'http://www.nielsenchemicals.com/nielsen/web.nsf/pages/stockist!open&country='+country 
	//return false;
	//}
});
/* Attach OnChange to Select for Location*/
$('#location-dd').change(function() {
var countrydd = $('#location-dd').val();
if(countrydd == "-------------------------------------"){
return false;
}
else{
  location.href= '/nielsen/web.nsf/pages/location!open&country='+escape(countrydd)
}
});
/*Add On Mouse Down to Event Home Page Stockist Field*/
$('#stockist_postcode').keyup(function(e) {	
if(e.keyCode == 13) {
 	$('#submit-stockist').click();
}
});
/* Attach OnClick to Search Button*/
  $('#search-button').click(function() {
	var searchquery = $('#search-text').val();
	
	if ( searchquery !=""){
	window.location.href=("/nielsen/web.nsf/search!searchview&query=*"+searchquery+"*");
	 return false;
	}
	else{
	alert("Please enter a search value"); 
	 $('#search-text').focus();
	return false;
	}
});
/*Add On Mouse Down to Event Search Field*/
$('#search-text').keyup(function(e) {	
if(e.keyCode == 13) {
 	$('#search-button').click();
}
});
  });



