var getCommentBox = function(identifier,content_unique){
	if(document.getElementById('currentOpenContent').value!=''){
	document.getElementById('head' + document.getElementById('currentOpenContent').value).style.display = 'block';
	}
	headBlock = document.getElementById('head' + identifier) ;
	headBlock.style.display = 'none';
	createNewElement('identifier' + identifier,'DIV','id;commentBlock|ALIGN;left|className;commentBox',false);
	createNewElement('commentBlock','DIV','id;closeBox|align;right|className;closeElement',false);
	createNewElement('closeBox','DIV','id;closeImg|className;closeBt',false);
	createNewElement('commentBlock','DIV','id;comment_container',false);
	createNewElement('commentBlock','DIV','id;commentContent',false);
	openTarget = identifier;
	//alert('get_extra_info.asp?MenuID=' + content_unique + '&CompType=' + document.getElementById('thisCompType').value + '&search=' + document.getElementById('thissearch').value);
	if(document.getElementById('thissearch')){
	ajax_loadContent('comment_container','get_extra_info.asp?MenuID=' + content_unique + '&CompType=' + document.getElementById('thisCompType').value + '&search=' + document.getElementById('thissearch').value,'true');
	}
		if(document.getElementById('thiscat')){
	ajax_loadContent('comment_container','get_extra_info.asp?MenuID=' + content_unique + '&CompType=' + document.getElementById('thisCompType').value + '&cat=' + document.getElementById('thiscat').value,'true');
	}
	
		//alert(content_unique);
	document.getElementById('currentOpenContent').value = identifier;
	document.getElementById('closeImg').innerHTML = 'sluiten';
	document.getElementById('closeImg').className = 'closeBt';
	document.getElementById('closeImg').onclick = function(){removeBox('commentBlock');headBlock.style.display = 'block';document.getElementById('currentOpenContent').value='';};
}
function GetTimeInMillisec()
{
    var Now = new Date()
    var UnStamp = Now.getTime()

    return UnStamp
}

var createNewElement = function(thisTarget,childType,newAttribute,doBefore){
		var targetDiv = document.getElementById(thisTarget);
		var newChild
		var existing_elem = new Array();
		var elements_arr = new Array();
		newChild = document.createElement(childType);
		//alert(childType);
			if(childType=='IFRAME'){
				newChild.name = GetTimeInMillisec();	
				newChild.frameBorder = '0';
				newChild.scrolling='no';
				//newChild.style.width = '100%';
			}
		if(newAttribute){
		//alert('1');
			var thisElementAttr_arr = newAttribute.split('|');
				for(i=0;i<thisElementAttr_arr.length;i++){
					//alert('1 | ' +i);
				var thisElementAttr = thisElementAttr_arr[i].split(';');
				if(thisElementAttr[0]!='className'){
					if(thisElementAttr[0]=='id' || thisElementAttr[0]=='align' ){
						if(document.getElementById(thisElementAttr[1])){
							removeBox(thisElementAttr[1]);
						}
						thisNewAttr = document.createAttribute(thisElementAttr[0]); 
						thisNewAttr.nodeValue = thisElementAttr[1];
						newChild.setAttributeNode(thisNewAttr) ;
						}
				} else {
				newChild[thisElementAttr[0]] = thisElementAttr[1];
				}
				}
		}
			
		//alert('5');	
		targetDiv.appendChild(newChild);
		existing_elem = targetDiv.getElementsByTagName('DIV');
		if(doBefore==true){
			//alert('doBefore')
			for(var no=0;no<existing_elem.length;no++){
				if(existing_elem[no].className=='Titel'){
					elements_arr = elements_arr + ',' + existing_elem[no].id;
				}	
			}	
			elements_arr = elements_arr.split(',');
			if(elements_arr[1]){
				targetDiv.insertBefore(newChild,document.getElementById(elements_arr[1]));
			}
			try{
			}catch(e){
				alert('doBefore error');
			}
		}
		return newChild;
}

//end createlement 

var removeBox = function(thisBox){
					var findParentNode=document.getElementById(thisBox).parentNode;
						findParentNode.removeChild(document.getElementById(thisBox));
}

var getOrderScreen = function(target){
	screenOverlay('div102');
	//document.getElementById('div157')
	contentIfame = createNewElement('div102','DIV','id;orderContent|className;orderContent',false);
	contentIfame2 = createNewElement('orderContent','IFRAME','id;orderContentIf|className;orderContent',false);
	closeContainer = createNewElement('orderContent','DIV','id;closeCont|align;right',false);
	infoScreen = createNewElement('orderContent','DIV','id;infoScreen|className;infoScreen',false);
	contentIfame.style.top = 33 + Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
	contentIfame.style.left = 50 + '%';
	contentIfame.style.height = '550px';
	contentIfame.style.width = (830) + 'px';
	contentIfame.style.zIndex = '160';
	contentIfame.style.position = 'absolute';
	contentIfame.style.backgroundColor = '#e0e1db';
	contentIfame.style.marginLeft = -((830)/2) + 'px';
	contentIfame2.style.marginLeft = '365px';
	contentIfame2.style.marginTop = '10px';
	contentIfame2.style.width = '450px';
	infoScreen.style.position = 'absolute';
	infoScreen.style.marginLeft = '15px';
	infoScreen.style.marginTop = '10px';
	infoScreen.id = 'infoScreen';
	closeContainer.style.position = 'absolute';
	closeContainer.style.marginTop = '-10px';
	closeContainer.style.backgroundColor = '#e0e1db';
	closeContainer.style.width = '830px';
	document.body.appendChild(contentIfame);
	contentIfame.appendChild(closeContainer);
	closeContainer.innerHTML = '<img src="images/bt_close.gif" alt="scherm sluiten" title="scherm sluiten" style="cursor:pointer;" onclick="closeIframeContent(\'div102\'); closeIframeContent(\'orderContent\');"/>';
	contentIfame.appendChild(infoScreen);
	contentIfame.appendChild(contentIfame2);
	contentIfame2.src = target;
	ajax_loadContent('infoScreen','get_extra_info2.asp?MenuID=1211380510687','true');
	//alert(contentIfame);
}
var closeIframeContent = function(target){
	document.body.removeChild(document.getElementById(target));
		
}