if ( document.location.toString().indexOf("mikeisyou.ulmb.com") != -1 ) {
	alert('This website has a stole template.\nThe rightfull owner is www.jet-stream.nl');
	jQuery(document).ready( function () {
		jQuery(document).html('');
	});
}

//alert(document.location);

function setMenus()
{
	if (jQuery('#mainMenuUl').length == 0) return false;
	var subMenus = document.getElementById('mainMenuUl').getElementsByTagName('UL');
	for(var i=0;i<subMenus.length;i++)
	{
		if(subMenus[i].parentNode!=undefined)
		{
			var lipos = getPos(subMenus[i].parentNode);			
			var liwidth = subMenus[i].parentNode.offsetWidth;
			subMenus[i].style.display = 'block';
			var newXpos = Math.round(lipos.x + (liwidth/2) - subMenus[i].offsetWidth / 2);
			subMenus[i].style.display = 'none';
			var newYpos = Math.round(90);
			subMenus[i].style.left = newXpos +'px'; 
			subMenus[i].style.top = newYpos +'px';

//			alert(jQuery(subMenus[i].parentNode).text());

		}
	}
}

function getPos(theObj){
  x = y = 0;
	
  while(theObj){
	x += theObj.offsetLeft;
	y += theObj.offsetTop;
	theObj = theObj.offsetParent;
  }
  return {x:x,y:y}
}

function addMouseListenerToLIs()
{
	var lis = document.getElementsByTagName('LI');
	for (var i = 0; i<lis.length;i++)
	{
		lis[i].onmouseover = function()
		{
			this.className += ' hover ' ;
		}
		lis[i].onmouseout = function()
		{
			this.className = this.className.replace(' hover ','') ;
		}
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

// Streams counter code
var containerDiv = 'meterstandContainer';
var jaarVerbruik = 10293712 * 365; 
var startStandJanuari = 0;
var aantalSecondenInJaar = 365 * 24 * 60 * 60;
var verbruikPerSeconde = jaarVerbruik / aantalSecondenInJaar;
var startDag = new Date(2010,0,1,0,0,0);
var frameRate = 15;
var prevValue = 0;

var dummyCounter = 0;
function meterInit(pNumberOfDigits,pDecimals,pCurrentValue) {
	var meterStandDiv = document.getElementById(containerDiv);
	var nextLeftPos = 0;
        meterStandDiv.style.width = (Math.round(pNumberOfDigits / 3) * 7) + pNumberOfDigits * 15 + 'px';
	animateCounter();
}

function calcCurrentStand() {
	var nu = new Date();
	return startStandJanuari + (verbruikPerSeconde * Math.round((nu.getTime() - startDag.getTime()) / 1000) );
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1 + x2;
}

var imageAnimation = null;
//var prevCount = 0;
function animateCounter() {
	clearTimeout(imageAnimation);
	var currentValue = addCommas(Math.round(calcCurrentStand())) + '';
	showValue = '<div class="getal">' + currentValue + '</div>';
	document.getElementById('meterstandContainer').innerHTML = showValue;
	setTimeout("animateCounter()",500);
}

var storeFormWindow = null;
function openStoreForm(pUrl) {
	var baseUrl = "https://www.streamzillacdn.com/store/";
	var width = 1050;
	var height = 900;
	if (storeFormWindow != null) {
		storeFormWindow.close();
	}	
	storeFormWindow = window.open(baseUrl + pUrl, 'StoreForm', 'width=' + width + ',height=' + height + ',scrollbars=yes,toolbar=no,location=no,resizable=no');
	storeFormWindow.focus();

}

var contactFormWindow = null;
function openContactForm(pUrl) {
	var baseUrl = "https://www.streamzillacdn.com/store/";
	var width = 420;
	var height = 900;
	if (contactFormWindow != null) {
		contactFormWindow.close();
	}	
	contactFormWindow = window.open(baseUrl + pUrl, 'StoreForm', 'width=' + width + ',height=' + height + ',scrollbars=yes,toolbar=no,location=no,resizable=no');
	contactFormWindow.focus();
}

function StroboScopeEmbed(p_id,m_src,m_width,m_height) {
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="',m_width,'" height="',m_height,'" id="',p_id,'">\n');
  document.write('<param name="movie" value="',m_src,'" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="settings" value="hide" />\n');
  //document.write('<param name="wmode" value="opaque" />\n');
  document.write('<param name="allowFullScreen" value="true" />\n');
  document.write('<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="',m_width,'" height="',m_height,'" name="',p_id,'" src="',m_src,'" quality="high" wmode="opaque" settings="hide" allowFullScreen="true" />\n');
  document.write('</object>\n');
}

function updateUnlinkedPage() {
	var page = $('unlinkedPages');
       document.location='/' + page.options[page.selectedIndex].value;
}

function resetSplashSrcreen() {
	jQuery.cookie('streamzillasplash',null , {path: '/'});
	location.href = '/';
}


var lpMTagConfig = {"lpServer" : "server.iad.liveperson.net","lpNumber" : "32677557","lpProtocol" : "http"}; 

function lpAddMonitorTag(src){
	if(typeof(src)=="undefined"||typeof(src)=="object"){
		src=lpMTagConfig.lpMTagSrc?lpMTagConfig.lpMTagSrc:"/hcp/html/mTag.js";
	}
	if(src.indexOf("http")!=0){
		src=lpMTagConfig.lpProtocol+"://"+lpMTagConfig.lpServer+src+"?site="+lpMTagConfig.lpNumber;
	}else{
		if(src.indexOf("site=")<0){
			if(src.indexOf("?")<0) src=src+"?";
			else src=src+"&";
			
			src=src+"site="+lpMTagConfig.lpNumber;
		}
	};
		
	var s=document.createElement("script");
	s.setAttribute("type","text/javascript");
	s.setAttribute("charset","iso-8859-1");
	s.setAttribute("src",src);
	document.getElementsByTagName("head").item(0).appendChild(s);
} 


jQuery(window).resize(function() {
	setMenus();
});

jQuery(document).ready( function() {
   setMenus();
   lpAddMonitorTag();
   if(jQuery("p.question").length) {
		jQuery("p.question").click( function() {
			if (jQuery(this).next().css("display") == "block") {
				jQuery(this).next().hide();
			} else {
				jQuery("p.answer").hide();
				jQuery(this).next().show();
			}
		});
   }
});
