function openprint (file) {
	width = 650;
	height = 500;
	leftmargin = 100;
	topmargin = 50;
	statusbar = "no";
	toolbar = "yes";
	menubar = "yes";
	title = "printing";
    window.open(file,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}

function openhelp (url) {
	width = 450;
	height = 350;
	leftmargin = 150;
	topmargin = 100;
	statusbar = "no";
	toolbar = "no";
	menubar = "no";
	title = "help";
    window.open(url,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}

function showimage(file) {
	if (file) {
		window.open("image_popup.html?file="+ file,"imagepopup","width=400,height=400,left=100,top=100");
	} else {
		return false;
	}
}
		
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
	
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
	
function MM_findObj(n, d) { //v4.0
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}
	
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function openenglish (file) {
	width = 430;
	height = 350;
	leftmargin = 100;
	topmargin = 100;
	statusbar = "no";
	toolbar = "no";
	menubar = "no";
	title = "english";
    winhelp = window.open(file,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
	window.winhelp.focus();
}

function cm_bwcheck(){
	//In theory we should use object detection, but this script needs work-arounds for almost every browser...
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.ns4=(!this.dom && document.layers)?1:0;
	this.op=window.opera 
	this.moz=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ie=this.agent.indexOf("msie")>-1 && !this.op
	if(this.op){
		this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1)
		this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1)
		this.op7=this.dom&&!this.op5&&!this.op6 //So all higher opera versions will use it
	}else if(this.moz) this.ns6 = 1
	else if(this.ie){
		this.ie4 = !this.dom && document.all
  	this.ie5 = (this.agent.indexOf("msie 5")>-1)
  	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
  	this.ie6 = this.dom && !this.ie4 && !this.ie5 && ! this.ie55
	}
	this.mac=(this.agent.indexOf("mac")>-1)
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.op7)
  this.usedom= this.ns6||this.op7//Use dom creation
  this.reuse = this.ie||this.op7||this.usedom //Reuse layers
  this.px=this.dom&&!this.op5?"px":""
	return this
}
var bw=new cm_bwcheck()

function menuHide(id) {
  if (bw.ie4){
    document.all[id].style.display = 'none';
    return false;
  } else if (bw.dom) {
    document.getElementById(id).style.display = 'none';
    return false;
  }
}

function menuShow(id) {
  if (bw.ie4){
    document.all[id].style.display = '';
    return false;
  } else if (bw.dom) {
    document.getElementById(id).style.display = 'block';
    return false;
  }
}

function menuChange(id,sid) {
  var id = ""+id+"";
  var sid = ""+sid+"";
  var i = 0;
  var s = 0;
  if (bw.ie4) {
    while (document.all['menu'+i]) { 
      if (id == i) {
 	    if (document.all['menu'+i].style.display == '') {
		  menuHide('menu'+i);
		} else {
		  menuShow('menu'+i);
		}
      } else {
		menuHide('menu'+i);
      }
  	  i++;
	}
	if (sid.length > 0) {
	while (document.all['submenu'+s]) { 
	  if (sid == s) {
		if (document.all['submenu'+s].style.display == '') {
		  menuHide('submenu'+s);
		} else {
		  menuShow('menu'+id);	
		  menuShow('submenu'+s);
		}
	  } else {
		menuHide('submenu'+s);
	  }
	  s++;
	}
	}
  } else if (bw.dom) {
    while (document.getElementById('menu'+i)) { 
      if (id == i) {
 	    if (document.getElementById('menu'+i).style.display == '') {
		  menuHide('menu'+i);
		} else {
		  menuShow('menu'+i);
		}
      } else {
		menuHide('menu'+i);
      }
  	  i++;
	}
	if (sid.length > 0) {
    while (document.getElementById('submenu'+s)) { 
      if (sid == s) {
 	    if (document.getElementById('submenu'+s).style.display == '') {
		  menuHide('submenu'+s);
		} else {
		  menuShow('menu'+id);	
		  menuShow('submenu'+s);
		}
      } else {
		menuHide('submenu'+s);
      }
  	  s++;
	}
	}
  }
}

function menuHideAll(id) {
  var i = 1;
  if (bw.ie4) {
    while (document.all['menu'+i]) { 
      menuHide(i);
 	  i++;
	}
  } else if (bw.dom) {
    while (document.getElementById('menu'+i)) { 
      menuHide(i);
	  i++;
    }
  }
}

function changeCase(obj) {
	var temp = obj.value.substring(0,1);
	var temp2 = obj.value.substring(1,obj.value.length);	
	obj.value = temp.toUpperCase() + temp2;
}

// Opens new window for payment
function openpay(mode) {
	if (mode == 1){
		width = 725;
		height = 550;
	} else {
		width = 775;
		height = 550;
	}
	leftmargin = 25;
	topmargin = 25;
	statusbar = "yes";
	toolbar = "no";
	menubar = "no";
	resizable = "yes";
	title = "paywindow";
	paywindow = window.open('./tpl/empty.html',title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar+',resizable='+resizable);
}

function opentracktrace () {
	width = 550;
	height = 350;
	leftmargin = 100;
	topmargin = 100;
	statusbar = "no";
	toolbar = "no";
	menubar = "no";
	title = "winTracknTrace";
    winTracknTrace = window.open('./tpl/blank.html',title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
	window.winTracknTrace.focus();
}

/*
		var img = new Array (10);
		img["home_out"] = new Image();
		img["home_out"].src = "./images/home.jpg";
		img["home_over"] = new Image();
		img["home_over"].src = "./images/home_over.jpg";
		img["newsletter_out"] = new Image();
		img["newsletter_out"].src = "./images/newsletter.jpg";
		img["newsletter_over"] = new Image();
		img["newsletter_over"].src = "./images/newsletter_over.jpg";
		img["search_out"] = new Image();
		img["search_out"].src = "./images/search.jpg";
		img["search_over"] = new Image();
		img["search_over"].src = "./images/search_over.jpg";
		img["help_out"] = new Image();
		img["help_out"].src = "./images/help.jpg";
		img["help_over"] = new Image();
		img["help_over"].src = "./images/help_over.jpg";
		img["sitemap_out"] = new Image();
		img["sitemap_out"].src = "./images/sitemap.jpg";
		img["sitemap_over"] = new Image();
		img["sitemap_over"].src = "./images/sitemap_over.jpg";
		img["userarea_out"] = new Image();
		img["userarea_out"].src = "./images/login.jpg";
		img["userarea_over"] = new Image();
		img["userarea_over"].src = "./images/login_over.jpg";

		function changeImage(id,mode) {
			var mode = (mode == 1) ? "over" : "out";
			document.getElementById("img_" + id).src = img[id + "_" + mode].src;
		}
*/


function getEmailAddress()
{
	values = new Array();
	var urlEnd = document.URL.indexOf('?');
	if (urlEnd != -1)
	{
		var params = document.URL.substring(urlEnd+1);
		params = params.split('&');
		for(var i=0; params.length>i; i++)
		{
			params[i]  = params[i].split('=');
			values[params[i][0]] = unescape(params[i][1]);
		}
	}
	return values['email'];
}

