/* AUTHOR: SOLAR-IT */

// *************************************
// Force framing
// *************************************
//if (top.location == self.location){top.location.href = "index.htm"}

// *************************************
// All layout scripting starts from here
// *************************************

// el - the element whitch will be marked
// * the element gets the xxxxOver class style
function mark(el)
{
  if(el.className == "menuItem")
  {el.className = "menuItemOver";}
	else
  {el.className = "linkToOver";}
}
// el - the element whitch will be unmarked
// * the element gets the xxxx class style
function unmark(el)
{
  if(el.className == "menuItemOver")
    {el.className = "menuItem";}
	else
    {el.className = "linkTo";}
}

// *************************************
// All cookie scripting starts from here
// *************************************

// Define global expire date variable
var expDate = new Date();

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// * Unset the language 
function unsetLanguage(){
calcExp(365);// number of days the cookie should last is 365
setCookie('language', 'None', expDate, "/");
}

// language - the language choosen
// * Set the language  
function setLanguage(language){
calcExp(365);// number of days the cookie should last is 365
setCookie('language', language, expDate, "/");
}

// * Redirect using stored cookie
function redirect(){
delay = 5;    // time in seconds before popup opens
timer = setTimeout("redirectlanguage()", delay*1000);
}

function redirectlanguage(){
var lang = getCookie('language');
  switch(lang){
      case "English":{
                window.location.href="gb_m/main.htm";
				break;}	
      case "Nederlands":{
                window.location.href="nl_m/main.htm";
				break;}	
  }   
}

// expDays - number of days the cookie should last
// * Calculate expire date
function calcExp(expDays){
expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays)); 
}


closetime = 10; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}

function doMainPopup() {
url = "http://www.solar-it.com/general/main_popup.htm";
width = 550;  // width of window in pixels
height = 250; // height of window in pixels
delay = 1;    // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}

function PrintRoute()
{
	var Obj = document.getElementById('PrintButton');
	Obj.style.display = "none";
	Obj.style.visibility = "hidden";	

	var Obj2 = document.getElementById('Bottom');
	Obj2.style.display = "none";
	Obj2.style.visibility = "hidden";	

	var Obj3 = document.getElementById('Up');
	Obj3.style.display = "none";
	Obj3.style.visibility = "hidden";	

	window.print();

	Obj.style.display = "inline";
	Obj.style.visibility = "visible";	

	Obj2.style.display = "inline";
	Obj2.style.visibility = "visible";	

	Obj3.style.display = "inline";
	Obj3.style.visibility = "visible";	
}

