﻿/*-------------------------
Cibavision.com Global JS
-------------------------*/

/* Generic Popup function */
	function openPopupCustom( url, windowname, height, width, scroll ) {
	  var popup = window.open( url , windowname, "toolbar=no,status=yes,scrollbars="+scroll+",menubar=no,locationbar=no,top=35,left=20,width="+width+",height="+height+",resizable=yes");
	  popup.focus();
	}
	
	/* Generic Popup function */
	function openPopupPrint( url, windowname ) {
	  var popup = window.open( url , windowname, "toolbar=no,status=yes,scrollbars=yes,menubar=yes,locationbar=no,top=35,left=20,width=640,height=400,resizable=yes");
	  popup.focus();
	}
	
// Grabs a parameter from the URL.  Returns an empty
// string if parameter does not exist.
function getParameter(param) {
        var val = "";
        var qs = window.location.search;
        var start = qs.indexOf(param);

        if (start != -1) {
                start += param.length + 1;
                var end = qs.indexOf("&", start);
                if (end == -1) {
                        end = qs.length
                }
                val = qs.substring(start,end);
        }
        return val;
}
// Call it like this: var contextstrform = getParameter("contextForm");

function printCheck(){
	var printTest = getParameter("print");
	
	if(printTest=='true'){
		document.write('<link href="/css/print.css" rel="stylesheet" type="text/css" media="all"/>')
	}	
}

/*-----------------------------------
Cookie Scripts
-----------------------------------*/

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 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);
		}
	}
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function countryCheck() {
	var countryCookieExists = readCookie('country')
		if (countryCookieExists)
		{
			location.href='http://www.cibavision-' + readCookie('country') + '.com/'
		}
}


function setDisclaimerTarget(disclaimertarget){
  target="";
  target=disclaimertarget;
  }
  
function openDisclaimer(urlt,w,h) {
  if (!urlt) { url="external_disclaimer.html"}
  else url = urlt;
  s=false;
  r=false;
  var scrl; var resze;
        scrl="scrollbars=no,";
         resze="resizable=no,";
        if (!w) w = 400;
        if (!h) h = 300;
        fenster = window.open(url,"_blank",scrl+resze+"width="+w+",height="+h+",screenX=200,screenY=50");
        fenster.focus();
}

