/*
   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" : "");
      //alert("Kakan är satt!");
  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;
    //alert("Kakan är tagen!");
  return unescape(dc.substring(begin + prefix.length, end));
}


function chkCookie() {
	if (getCookie('tSlideshow') == null)
		showLayer('slideshowplacer');
}

function setC() {
	setCookie('tSlideshow','true');
}


/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

/*function SwitchMenu(obj){
	if(document.getElementById){
			var el = document.getElementById(obj);
			var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
			if (ar[i].className=="submenu") //DynamicDrive.com change
			ar[i].style.display = "none";
		}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}*/

sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);

function blocktoggle(id)
{
	if (document.layers)
	{
		current = (document.layers[id].display == 'none') ? 'block' : 'none';
		document.layers[id].display = current;
	}
	else if (document.all)
	{
		current = (document.all[id].style.display == 'none') ? 'block' : 'none';
		document.all[id].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
		document.getElementById(id).style.display = vista;
	}
}

function showLayer(id){
	if (document.layers)
	{
		current = (document.layers[id].display = 'block');
		document.layers[id].display = current;
	}
	else if (document.all)
	{
		current = (document.all[id].style.display = 'block');
		document.all[id].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.display = 'block');
		document.getElementById(id).style.display = vista;
	}
}

function hideLayer(id){
	if (document.layers)
	{
		current = (document.layers[id].display = 'none');
		document.layers[id].display = current;
	}
	else if (document.all)
	{
		current = (document.all[id].style.display = 'none');
		document.all[id].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.display = 'none');
		document.getElementById(id).style.display = vista;
	}
}

function rma(aLnk,pre) {
	var mt = "mailto:";
	var d = "eisai";
	var mtf = mt + pre + "@" + d + ".net";
	aLnk.href = mtf;
	}
	if(top.location != this.location) {
	top.location = this.location;
}

function rma2(aLnk,pre) {
	var mt = "mailto:";
	var d = "kinchard";
	var mtf = mt + pre + "@" + d + ".dk";
	aLnk.href = mtf;
	}
	if(top.location != this.location) {
	top.location = this.location;
}


// ---------- script properties ----------


var results_location = "/results.jsp";


// ---------- end of script properties ----------


function search_form(jse_Form) {
	if (jse_Form.d.value.length > 0) {
		document.cookie = "d=" + escape(jse_Form.d.value) + "; path=/";
		window.location = results_location;
	}
}


function changeCountry(c) {

	country = $(c).src;
	country = country.substring(country.lastIndexOf("\/")+1,country.length);

	try {
		if (country == 'map' + c + '.gif') {
			$(c).src = '/gui/images/map/map' + c + 'Sel.gif';
		} else {
			$(c).src = '/gui/images/map/map' + c + '.gif';
		}
	
	} catch(err) {
	
	}
}

// ------------ function for big map on index page ------

function changeCountryBig(c) {

	country = $(c).src;
	country = country.substring(country.lastIndexOf("\/")+1,country.length);

	try {
		if (country == 'map' + c + '.gif') {
			$(c).src = '/gui/images/bigMap/map' + c + 'Sel.gif';
		} else {
			$(c).src = '/gui/images/bigMap/map' + c + '.gif';
		}
	
	} catch(err) {
	
	}
}


// ---------- preloading images for mouseover map ----------

<!--
if (document.images)
{
  pic1= new Image(); 
  pic1.src="/gui/images/map/mapFISel.gif"; 

  pic2= new Image(); 
  pic2.src="/gui/images/map/mapSESel.gif"; 

  pic3= new Image(); 
  pic3.src="/gui/images/map/mapDKSel.gif"; 

  pic4= new Image(); 
  pic4.src="/gui/images/map/mapNOSel.gif"; 
  
  pic5= new Image(); 
  pic5.src="/gui/images/map/mapISSel.gif"; 
}
//-->

// menu 

function menu(id) {
	var e = document.getElementById(id);
	var a = document.getElementById("main_menu").getElementsByTagName("ul");
	
	if (e.style.display != "block") {
		for (var i = 0; i < a.length; i++) {
			if (a[i].className = "sm") {
				a[i].style.display = "none";
			}
		}
		e.style.display = "block";
	} else {
		e.style.display = "none";
	}
}

function submenu(id, parent) {
	var e = document.getElementById(id);
	var a = document.getElementById(parent).getElementsByTagName("ul");
	
	if (e.style.display != "block") {
		for (var i = 0; i < a.length; i++) {
			if (a[i].className = "sm2") {
				a[i].style.display = "none";
			}
		}
		e.style.display = "block";
	} else {
		e.style.display = "none";
	}
}

// notice

function notice_pages(url, url2) {
	var x = readCookie('notice');
	
	if (!x) {
		$('notice').style.height = $('mainContent').getHeight() + "px";
		$('notice').style.display = 'block';
		$('yes').setAttribute("href", "javascript:no_notice('" + url + "', true)");
		$('n').setAttribute("href", "javascript:no_notice('" + url2 + "', false)");
		$('sm3').style.display = 'none';
	}
}

function notice(url) {
	var x = readCookie('notice');
	
	if (!x) {
		$('notice').style.height = $('mainContent').getHeight() + "px";
		$('notice').style.display = 'block';
		$('products').setAttribute("class", "active_link");
		//alert("javascript:no_notice('" + url + "')");
		//$('home').setAttribute("class", "");
		$('yes').setAttribute("href", "javascript:no_notice('" + url + "', true)");
	} else {
		$('products').setAttribute("href", "?section=sm3");
		
		parent.top.location = url;
	}
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function  no_notice(url, status) {
	var x = readCookie('notice');
	if (!x && status == true) {
		createCookie('notice', 'noticecookie');
		//$('notice').style.display = 'none';
		parent.top.location = url;
	} else {
		parent.top.location = url;
	}
}

function close_notice() {
	$('notice').style.display = 'none';
	parent.top.location = '/start.jsp';
}