//Copyright Brett Martin Ltd
//=====================================================
function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}
//======================================================
function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString() + ";path=/");
}
//==========================================
function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
//==============================================
function DoTheCookieStuff()
{
BMlangpref=getCookie('BMlangprefV2');
if (BMlangpref=="esp") 
	{window.location="/espanol"}
else if (BMlangpref == "deu") 
 	 {window.location="/deutsch"}
else if (BMlangpref == "fra") 
 	 {window.location="/francais"}
else if (BMlangpref == "ita") 
 	 {window.location="/italiano"}
else if (BMlangpref == "por")
	 {window.location="/portugues/"}
else if (BMlangpref == "rus")
	 {window.location="/russian/"}
else if (BMlangpref == "cze")
	 {window.location="/czech/"}
else if(BMlangpref==null) 
	 {}

}
//=====================================================
function ChangeWindow(newLocation)
{
window.opener.location=newLocation;
self.close();

}

//=========================================================
function ChangeWindowPref(pref)
{
delCookie('BMlangprefV2');

setCookie('BMlangprefV2',pref,365);

     if (pref =="eng")
	{
		window.location ="/index.aspx"		
	}
else if (pref=="esp") 
	{
		 window.location ="/espanol/"		
	}
else if (pref == "deu") 
 	{
		 window.location ="/deutsch/"
	}
else if (pref == "fra") 
 	{
		window.location ="/francais/"
	}
else if (pref == "ita") 
 	{
		window.location ="/italiano/"
	}
else if (pref == "por")
		{
		window.location ="/portugues/"
	}
else if (pref == "rus")
	{
		 window.location ="/russian/"
	}
else if (pref == "cze")
	{
		 window.location ="/czech/"
	}
}
