var varCMSTable;
var varCMSID;
var varCMSIDT;
var varCMSIDPC;
var varCMSxID;
var varRPThema;
var varRPPortaal;
var CMSAction;
var varCodeLogin;

varRPPortaal=1;

function alertWin(gotoURL,msg){
	if (confirm(msg)){
		sUrl = gotoURL + '&del=1'
		//alert(sUrl)
		window.location.href = sUrl
	}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function setFrame(Page,IDProduct){
	objFrame=MM_findObj('winFrame');
	gotoURL=Page+'?IDproduct=' + IDProduct;
	objFrame.src=gotoURL;
	MM_showHideLayers('winLarge','','show');
}

function setFrameSmall(Page,IDPage){
	objFrame=MM_findObj('winFrameSmall');
	gotoURL=Page+'?IDPage=' + IDPage;
	objFrame.src=gotoURL;
	MM_showHideLayers('winSmall','','show');
}

function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function hideOverlay(){
	//document.body.style.overflow='';
	oOverlay=MM_findObj('totalOverlay')	
	
	if(oOverlay){
		oOverlay.style.display='none';	
	}
	oFrame=MM_findObj('frameTop')	
	if(oFrame){
		oFrame.src='empty.html'
	}
}
function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}

function randomNumber(limit){
  return Math.floor(Math.random()*limit);
}

function randOrd(){
return (Math.round(Math.random())-0.5); } 

function submitForm(frmName){
	oForm=MM_findObj(frmName);
	oForm.submit();
}
function showPageTitle(){
	objPageTitle=MM_findObj('themaText')
	objPageTitle.style.display='block'
}

function hideAll(tagName){
	var tag = document.getElementsByTagName('UL')
	for(x=0; x<tag.length; x++){
	//hide all div layers with the 'nav' attribute	
		if(tag[x].getAttribute(tagName)){
			tag[x].style.left='-10000px';
		}
	}
}

function hideAllCMS(){
	var tag = document.getElementsByTagName('DIV')
	for(x=0; x<tag.length; x++){
	//hide all div layers with the 'nav' attribute	
		if(tag[x].getAttribute('cms')){		
				tag[x].style.display='none';

		}
	}
}
function setCMS(){
	var tag = document.getElementsByTagName('DIV')
	for(x=0; x<tag.length; x++){
	//hide all div layers with the 'nav' attribute	
		if(tag[x].getAttribute('cms')){
			if (tag[x].style.display=='block'){
				tag[x].style.display='none';
			}else{
				tag[x].style.display='block';	
			}
		}
	}
}


function closeLayer(){
	oWindow=MM_findObj('windowTop')
	if(oWindow){
		oWindow.style.display='none';
	}
}

function getScrollHeight(){
	var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
	return h ? h : 0;
}
function openLayer(iWidth,iHeight,sPage){
	hideCMS();
	oOverlay=MM_findObj('totalOverlay');	
	yScroll=getScrollHeight();	
	//document.body.style.overflow='hidden';
	winHeight=document.documentElement.clientHeight;
	winWidth=document.documentElement.clientWidth;
	
	var myWidth = 0, myHeight = 0;
	oContainer=MM_findObj("container")
	if (oContainer){
		hContainer=oContainer.offsetHeight
	}
	
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  	winHeight=myHeight;
	winWidth=myWidth;

	
	if(oOverlay){
		oOverlay.style.display='block'
		oOverlay.style.height=hContainer+80 +'px';
		
	}
	
	oWindow=MM_findObj('windowTop')
	if(oWindow){
		oWindow.style.display='block';
		oWindow.style.top=yScroll+100+'px';
		oWindow.style.width=iWidth+'px';
		oWindow.style.height=iHeight+'px';
		oWindow.style.left=(winWidth-iWidth)/2 + 'px';
	}
	oFrame=MM_findObj('frameTop')
	if(oFrame){
		oFrame.style.display='block';
		oFrame.style.width=iWidth-10+'px';
		oFrame.style.height=iHeight-30+'px';
		oFrame.src=sPage;
	}
	oClose=MM_findObj('winClose')
	if(oClose){
		oClose.style.width=iWidth-10+'px';
	}
	oTrans=MM_findObj('winTrans')
	if(oTrans){
		oTrans.style.height=iHeight-10+'px';
	}
	
	oMT=MM_findObj('winMT')
	if(oMT){
		oMT.style.width=iWidth-10+'px';
	}
	oMB=MM_findObj('winMB')
	if(oMB){
		oMB.style.width=iWidth-10+'px';
	}
}
function closeQuote(){
	oFrame=MM_findObj('frameQuoteTop')	
	if(oFrame){
		oFrame.src='empty.html'
	}
	oWindow=MM_findObj('quoteTop')
	if(oWindow){
		oWindow.style.display='none';
	}
}

function showPartnerInfo(oInfoItem,sText,sLogo,sPartner){
	oItem=MM_findObj('popupPartner')
	oText=MM_findObj('popUpPartnerBody')
	pos=findPos(oInfoItem);
	oText.innerHTML='<div><h2>'+sPartner +'</h2>'+sText+'</div><div><img src="/images/cms/100/'+sLogo+'"></div>';
	oItem.style.left=pos.x-oItem.offsetWidth+13 + 'px';
	oItem.style.top=pos.y-oItem.offsetHeight+16 + 'px';

	
}

function openQuote(oItem,iTop,iLeft,iWidth,iHeight,sPage){
	
	pos=findPos(oItem);
	iTop=pos.y-iTop;

	winHeight=document.documentElement.clientHeight;
	winWidth=document.documentElement.clientWidth;

	oWindow=MM_findObj('quoteTop')
	if(oWindow){
		oWindow.style.display='block';
		oWindow.style.width=iWidth+'px';
		oWindow.style.height=iHeight+'px';
		oWindow.style.top=iTop+'px';
		oWindow.style.left=(winWidth-iWidth)/2 - iLeft+'px';
		
	}
	oFrame=MM_findObj('frameQuoteTop')
	if(oFrame){
		oFrame.style.display='block';
		oFrame.style.width=iWidth-40+'px';
		oFrame.style.height=iHeight-45+'px';
		oFrame.src=sPage;
	}
}

function showCMS(oItem,iID,iIDT,iIDPC,ixID){
	varCMSID=iID;
	varCMSIDT=iIDT
	varCMSIDPC=iIDPC
	varCMSxID=ixID
	pos=findPos(oItem);
	iTop=pos.y+10;
	iLeft=pos.x+10;

	oItem=MM_findObj('menuItem1')
	if(oItem){
		if(ixID==0){
			oItem.style.display='none';
		}else{
			oItem.style.display='block';
		}
	}
	

	oWindow=MM_findObj('cmsMenu')
	if(oWindow){
		oWindow.style.display='block';
		oWindow.style.top=iTop+'px';
		oWindow.style.left=iLeft+'px';
	}
	
	
}

function hideCMS(){
	oWindow=MM_findObj('cmsMenu')
	if(oWindow){
		oWindow.style.display='none';
	}
}

function showCMSWindow(iAction){
	switch (iAction){
		case 1://wijzig
			gotoURL='/cms2009/indexWindow.asp?ID='+varCMSID+'&IDT='+varCMSIDT+'&IDPC='+varCMSIDPC+'&xID='+varCMSxID +"&CL="+ varCodeLogin+"&IDDocThema="+ varRPThema
			openLayer(640,520,gotoURL);
		break;
		case 3://nieuw
			varCMSxID='';
			gotoURL='/cms2009/indexWindow.asp?ID='+varCMSID+'&IDT='+varCMSIDT+'&IDPC='+varCMSIDPC+'&xID='+varCMSxID +"&CL="+ varCodeLogin+"&IDDocThema="+ varRPThema
			openLayer(640,520,gotoURL);
		break;
		case 4://verwijder
			gotoURL='/delWindow.asp?ID='+varCMSID+'&IDT='+varCMSIDT+'&IDPC='+varCMSIDPC+'&xID='+varCMSxID +"&CL="+ varCodeLogin+"&IDDocThema="+ varRPThema
			openLayer(300,200,gotoURL);
		break;
	}
	//gotoURL='CMSTable.asp?Table='+varCMSTable +'&ID='+varCMSID +'&Action='+iAction
	
	
}



function findPos(ctrl){
	var pos = {x:0,y:0}
	if (ctrl.offsetParent){
		while(ctrl.offsetParent){
		   pos.x+= ctrl.offsetLeft;
		   pos.y+= ctrl.offsetTop;
		   ctrl=ctrl.offsetParent;
		   }
	}else{
		  pos.x += ctrl.x;
		  pos.y += ctrl.y;
	  }
	  return pos;
}
function setSearchTab(tabVisible,tabV){
	tab1=MM_findObj('searchDoc')
	tab2=MM_findObj('searchNews')
	tab3=MM_findObj('searchAgenda')
	tab4=MM_findObj('searchLink')
	tab5=MM_findObj('searchContact')
	tab1.style.display='none';
	tab2.style.display='none';
	tab3.style.display='none';
	tab4.style.display='none';
	tab5.style.display='none';
	
	tabx1=MM_findObj('tabDoc')
	tabx2=MM_findObj('tabNews')
	tabx3=MM_findObj('tabAgenda')
	tabx4=MM_findObj('tabLink')
	tabx5=MM_findObj('tabContact')
	tabx1.style.backgroundColor='#EEEEEE';
	tabx2.style.backgroundColor='#EEEEEE';
	tabx3.style.backgroundColor='#EEEEEE';
	tabx4.style.backgroundColor='#EEEEEE';
	tabx5.style.backgroundColor='#EEEEEE';
	tabx1.style.fontWeight='normal';
	tabx2.style.fontWeight='normal';
	tabx3.style.fontWeight='normal';
	tabx4.style.fontWeight='normal';
	tabx5.style.fontWeight='normal';
	tabx1.style.color='#666666';
	tabx2.style.color='#666666';
	tabx3.style.color='#666666';
	tabx4.style.color='#666666';
	tabx5.style.color='#666666';
	
	tabV=MM_findObj(tabV)
	tabV.style.backgroundColor="#ffffff";
	tabV.style.fontWeight="bold";
	tabV.style.color="#000000";

	tabVis=MM_findObj(tabVisible)
	tabVis.style.display='block';
	
}

function setSelectAction(){
	oAction=MM_findObj("iAction")
	oflagAction=MM_findObj("flagAction")
	if(oAction.value!='0'){	
		oflagAction.value='1'
		oForm=MM_findObj('selectForm')
		switch (oAction.value){
			case "5":
				oForm.action="mailWindow.asp"				
				break;
			case "1":
				oForm.action="mailWindow.asp"				
				break;
			default:
				
		}
		oForm.submit();
	}else{
		alert('U moet een actie kiezen')
	}
}

function showMail(){
	
}

function setUserSelections(numUser){
	oAll=MM_findObj('selUserAll')
	if (oAll.checked){
		sValue=true;	
	}else{
		sValue=false;
	}
	for(i=0;i<numUser;i++){
		oItem=MM_findObj('selUser'+i)
		if (oItem){
			oItem.checked=sValue;
		}
	}
}

function submitFilter(){
	oForm=MM_findObj("formFilter")
	oForm.submit();	
}

	function formSearch(){
		document.frmSearch.submit();
	}