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 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 alertWin(msg){
	if (confirm(msg)){
		document.cmsFinalise.submit();
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 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 chkString(data){
var tS="";
var stringChar='';
  var iChars = "!@#$%^&*()+=[]';,/{}|\"<>?~"; 
   for (var i = 0; i < data.length; i++) {
  	if (iChars.indexOf(data.charAt(i)) != -1) {
		stringChar=stringChar + tS + data.charAt(i)
		tS=", "
  	}
	if (stringChar!=''){
		alert ("De naam van het document bevat tekens ("+ stringChar+") die niet toegestaan zijn.\n Wijzig de bestandsnaam en probeer het opnieuw.");
		oItem=MM_findObj("THEFILE")
		
		if (oItem){
			document.location.reload();
		}
		return false;
	}
  }
}

function gotoAfronden(){
	oItem=MM_findObj("boxUpload");
	oItem.style.display="none";
	oItem=MM_findObj("boxAfronden");
	oItem.style.display="block";
}

function gotoUploaden(){
	oItem=MM_findObj("boxUpload");
	oItem.style.display="block";
	oItem=MM_findObj("boxAfronden");
	oItem.style.display="none";
}

function putAction(){
	oSearch=MM_findObj("sTextSearch")
	oHiddenSearch=MM_findObj("hiddenSearch")
	oHiddenSearch.value=oSearch.value
	oForm=MM_findObj("listForm");	
	oForm.submit();
}

function deleteFromList(){
	oForm=MM_findObj("listForm");	
	oForm.submit();
}

function setInactive(){
	oForm=MM_findObj("listForm");	
	oForm.submit();
}

function switchRemarks(){
	oItem=MM_findObj("noChangeRemarks")	;
	oItem.style.display='none';
	
	oItem=MM_findObj("changeRemarks")	;
	oItem.style.display='block';
}

function saveRemarks(){
	oForm=MM_findObj("formRemark")	
	oForm.submit()
}

function setReason(){
	oForm=MM_findObj("formReason")	
	oForm.submit()
}

function setReasonBox(status){
	oBox=MM_findObj("boxReason")
	oButton=MM_findObj("formButtons")
	if (status==1){
		oBox.style.display='block';
		oButton.style.display='none';
	}else{
		oBox.style.display='none';	
		oButton.style.display='block';
	}
	
}
