// JavaScript Document


	var path = 'en/';

	var fullurl = String(window.location);
	
	/*if(fullurl.indexOf('koodomobile.com') == -1){		
		window.location = "http://www.koodomobile.com";
	}*/

	var region = fullurl.indexOf('region');
	
	if(region == -1){
		var prov = Get_Cookie('prov');
		var lang = Get_Cookie('lang');
		
		if(prov && lang){	
			//switch back for deployment
			window.location = lang+"/"+prov+"/index.shtml";
			//window.location = lang+"/index.shtml";
		}
	}	



/* Optional: Temporarily hide the "tabber" class so it does not "flash"
   on the page as plain HTML. After tabber runs, the class is changed
   to "tabberlive" and it will appear.
*/
document.write('<style type="text/css">.tabber{display:none;}<\/style>');

var tabberOptions = {

  /* Optional: instead of letting tabber run during the onload event,
     we'll start it up manually. This can be useful because the onload
     even runs after all the images have finished loading, and we can
     run tabber at the bottom of our page to start it up faster. See the
     bottom of this page for more info. Note: this variable must be set
     BEFORE you include tabber.js.
  */
  'manualStartup':true,

  /* Optional: code to run after each tabber object has initialized */

	

  'onLoad': function(argsObj) {
    
    if (argsObj.tabber.id == 'tab2') {
      alert('Finished loading tab2!');
    }
  },

  /* Optional: code to run when the user clicks a tab. If this
     function returns boolean false then the tab will not be changed
     (the click is canceled). If you do not return a value or return
     something that is not boolean false, */

  'onClick': function(argsObj) {

    var t = argsObj.tabber; /* Tabber object */
    var id = t.id; /* ID of the main tabber DIV */
    var i = argsObj.index; /* Which tab was clicked (0 is the first tab) */
    var e = argsObj.event; /* Event object */

    if (id == 'tab2') {
      return confirm('Swtich to '+t.tabs[i].headingText+'?\nEvent type: '+e.type);
    }
  },

  /* Optional: set an ID for each tab navigation link */
  'addLinkId': true

};



loadPage = function(lang,blurb){
	var provObj = getElement(lang+"Prov");
	if(!(provObj.value == undefined || provObj.value == '')){	
		
		set_Cookie("prov",provObj.value,1000,domain);
		set_Cookie("lang",lang,1000,domain);
		
		var reqURL = Get_Cookie('requestedURL');
		
		
		if(reqURL){	
			if(provObj.value != "sk"){
				window.location = reqURL;
				Delete_Cookie('requestedURL');	
			}else{
				//window.location = reqURL;
				Delete_Cookie('requestedURL');	
				infoShield(true,reqURL,blurb);	
			}
		}else{
			
			//switch back for deployment
			if(provObj.value != "sk"){
				window.location = lang+"/"+provObj.value+"/index.shtml";
			}else{
				window.location = lang+"/"+provObj.value+"/index.shtml";
				//var loc = lang+"/"+provObj.value+"/index.shtml";
				//infoShield(true,loc,blurb);	
			}
			
			/*if(provObj.value != "sk"){
				window.location = lang+"/index.shtml";
			}else{
				var loc = lang+"/index.shtml";
				infoShield(true,loc,blurb);	
			}*/
		}
	}else{
		if(lang == 'en'){
			infoShield(true,null,'Please choose a province!');
		}else{
			infoShield(true,null,'Veuillez sélectionner une province!')
		}	
	}	
	
}

infoShield = function(toggle,newLink,blurb){
		
		if(toggle){ 
			this.newLink = newLink;
			var displayObj = getElement("shield");				
			//find page size
			var size = pageSize();
			var height = size.height;			
			var width = size.width;	
			//alert(document.documentElement.clientHeight)
			//if(height<620){
				height = document.documentElement.clientHeight;	
				if(height<window.innerHeight){
					height = window.innerHeight;
				}
				
				
			//}
			var insideShieldObj = getElement("insideShield");
			insideShieldObj.style.width=width+'px'
			insideShieldObj.style.height = height+'px';
			displayObj.style.display = '';
			var infoObj = getElement("infoPopUp");
			infoObj.className = "insideText_popup";
			var blurbObj = getElement("infoBlurb");
			blurbObj.innerHTML = blurb;
			
			infoObj.style.top =(180)+"px";
			//alert(infoObj.style.top)
			infoObj.style.left =((width -400)/2)+"px";
		
			var creditObj = document.getElementsByTagName("select");
			for(var i =0;i<creditObj.length;i++){
				creditObj[i].style.display = 'none';	
			}				
		
		}else{	
			var displayObj = getElement("shield");
			displayObj.style.display = 'none';
			if(this.newLink != null){
				window.location = this.newLink;
			}
			var creditObj = document.getElementsByTagName("select");
			for(var i =0;i<creditObj.length;i++){
				creditObj[i].style.display = '';	
			}
		}	
}
