function CreatePopupDiv()
{
	this.body		= "";
	this.title		= "";
	this.text		= "";//If you want to have some breaks between the lines, just put # for as a break.
	this.opacity	= "";//For the transparency of the overall background
	this.line 		= "";//Color of the text div border color
	this.darktext 	= "";//Color of the text  
	this.bgC 		= "";//Color of the title div background
	this.bg 		= "";//Background color of the overall background
	this.start		= "";
	this.div 		= "";
	this.click		= 0;
	this.doc		= "";
	this.startFrame = "";//zet dit op top
	this.back		= "";//"Y 
	this.onload		= "";//"no 
	this.Top		= "75";
	this.marginTop	= "";
	this.popupWidth	= 500;
	this.noOnclkTXT	= "";
	this.type		= "text";
}

//if(location.href.indexOf("webdev") != '-1' || location.href.indexOf("tst") != '-1'){
	CreatePopupDiv.prototype.insertDiv = function()
	{
		var obj_tbl				= document.body.getElementsByTagName("iframe")[0];
		var div					= document.createElement('div');
		div.style.position 		= 'relative';
		div.style.font	 		= '1em verdana';
		div.style.textAlign		= 'left';
//		div.style.color	 		= '#FFFFFF';
		div.style.color	 		= '#FF0000';
//		div.style.background	= '#FF8282';
		div.style.background	= '#FFFFFF';
		div.style.marginTop		= '10px';
		div.style.bottom		= '5px';
		div.style.paddingLeft	= '5px';
		div.style.paddingTop	= '8px';
		div.style.border		= '1px solid #FF0000';
		var str_txt				= this.text.replace(/#/g,"<br>");
		str_txt					= str_txt.replace(/([0-9])/g,'<b>$1</b>');
		var obj_ipt				= document.getElementsByTagName("input");
		for(i=0;i<obj_ipt.length;i++){
			if(obj_ipt[i].type == 'button'){
			var obj_button					= obj_ipt[i].cloneNode(true);
//			obj_ipt[i].type					= 'text';
			obj_ipt[i].className			= 'st';
			obj_ipt[i].style.fontSize		= '0.9em';
			obj_ipt[i].style.fontStyle		= 'italic';
			obj_ipt[i].style.textDecoration	= 'underline';
			obj_ipt[i].style.cursor			= 'pointer';
			obj_ipt[i].style.border			= '0px';
			obj_ipt[i].style.width			= '150px';
			obj_button.style.marginLeft 	= "280px";
			obj_button.style.marginBottom	= "5px";
			break;
			}
		}
	
		var innerHTML			= "<div style='font-weight:bolder;background:url(/swimages/icons/error.png) no-repeat;padding-left:16px;height:20px;margin-bottom:5px'>";
		innerHTML				+= this.title;
		innerHTML				+= "</div>";
		innerHTML				+= str_txt;
		
		div.innerHTML			= innerHTML;
		try{
		div.appendChild(obj_button);
		}catch(excp){}
		try{
		obj_tbl.parentNode.insertBefore(div,obj_tbl);
		}catch(excp){}
	}
//}else{
//	CreatePopupDiv.prototype.insertDiv = function()
//	{
//		var obj_tbl				= document.body.getElementsByTagName("iframe")[0];
//		var div					= document.createElement('div');
//		div.style.position 		= 'relative';
//		div.style.font	 		= '1em verdana';
//		div.style.textAlign		= 'left';
//		div.style.color	 		= '#FF0000';
//		div.style.background	= '#FFFFFF';
//		div.style.marginTop		= '5px';
//		div.style.bottom		= '5px';
//		div.style.paddingLeft	= '5px';
//		div.style.paddingTop	= '8px';
//		div.style.border		= '1px solid #FF0000';
//		var str_txt				= this.text.replace(/#/g,"<br>");
//		str_txt					= str_txt.replace(/([0-9])/g,'<b>$1</b>');
//	
//		div.innerHTML			= "<div style='font-weight:bolder;background:url(/swimages/icons/error.png) no-repeat;padding-left:16px;height:20px;margin-bottom:5px'>"+this.title+"</div>"+str_txt;
//		
//		obj_tbl.parentNode.insertBefore(div,obj_tbl);
//	}
//}
CreatePopupDiv.prototype.CreatDiv = function()
{
//	if(location.href.indexOf(".cgi") != '-1' && parent.vulin.document.form.IP.value == "10.177.20.157"){
	if(location.href.indexOf(".cgi") != '-1'){
		window.onload			= this.insertDiv.bind(this); 
//		var obj_tbl				= document.body.getElementsByTagName("form")[0];
//		obj_tbl					= (typeof(obj_tbl) == 'undefined')?document.body.getElementsByTagName("form")[0].getElementsByTagName("table")[0]:obj_tbl;
//		var div					= document.createElement('div');
//		div.style.position 		= 'relative';
//		div.style.font	 		= '1em verdana';
//		div.style.color	 		= '#FF0000';
//		div.style.background	= '#FFE5E5';
//		div.style.marginTop		= '10px';
//		div.style.bottom		= '5px';
//		div.style.paddingLeft	= '5px';
//		div.style.paddingTop	= '8px';
//		div.style.border		= '1px solid #FF0000';
//		var str_txt				= this.text.replace(/#/g,"<br>");
//		str_txt					= str_txt.replace(/([0-9])/g,'<b>$1</b>');
//
//		div.innerHTML			= "<div style='font-weight:bolder;background:url(/swimages/icons/error.png) no-repeat;padding-left:16px;height:20px;margin-bottom:5px'>"+this.title+"</div>"+str_txt;
//		
//		obj_tbl.parentNode.insertBefore(div,obj_tbl);
	}else{
		if(this.startFrame == "top"){
		this.body	= top.window.document.body;
		this.doc	= top.window.document;	
		}else{
		this.body	= window.document.body;
		this.doc	= window.document;	
		}
		this.text 	= this.text.replace("\n","#");
		this.text 	= this.text.replace("\r","#");	
		this.text 	= this.text.replace("<br>","#");	
	
		this.tDate 	= new Date();
		this.start 	= this.tDate.getHours() + "" + this.tDate.getMinutes() + ""  + this.tDate.getSeconds();
		var div		= new Array();
		var text	= new Array();
		var br		= new Array();
		
		this.arr_text = this.text.split("#");
	
		if(this.line == '' && this.darktext == '' && this.bgC == '' && this.bg == ''){
			switch(this.status){
				case "0":
					this.line 		= "#3366CC"; 
					this.darktext	= "#3366CC";
					this.bgC		= "#E9F4FF";
					this.bg			= "#111111"; 
				break;
				case "1":
					this.line 		= "#FF7D00"; 
					this.darktext	= "#EF0000";
					this.bgC		= "#FFCC66"; 
					this.bg			= "#111111"; 
				break;
				default:
					this.line 		= "#3366CC"; 
					this.darktext	= "#3366CC";
					this.bgC		= "#E9F4FF"; 
					this.bg			= "#111111"; 
				break;
			}
		}
		if(this.opacity == ''){
			this.opacity 		= "40";
		}
		
		div[0] 						= this.doc.createElement("div");
		div[0].id 					= 'picDiv0';
		div[0].style.position 		= 'absolute';
		div[0].style.zIndex 		= '100';
		div[0].style.top 			= '0';
		div[0].style.left 			= '0';
	
		if(this.body.offsetWidth > this.body.scrollWidth){
		div[0].style.width 			= '100%';
		}else{
		div[0].style.width 			= this.body.scrollWidth;
		}
		if(this.body.offsetHeight > this.body.scrollHeight){
			if(this.body.offsetHeight < 620){
			div[0].style.height 		= "700px";
			}else{
			div[0].style.height 		= this.body.offsetHeight;
			}
		}else{
			if(this.body.scrollHeight < 620){
			div[0].style.height 		= "700px";
			}else{
			div[0].style.height 		= this.body.scrollHeight;
			}
		}
		div[0].style.background 	= this.bg;
		div[0].style.filter 		= 'alpha(opacity='+this.opacity+')';
		div[0].style.opacity 		= (parseFloat(this.opacity) / 100);
		div[0].onclick				= this.CloseDiv.bind(this);
	
		div[1] = this.doc.createElement("div");
		div[1].id 					= 'picDiv1';
		div[1].style.zIndex 		= '101';
		div[1].style.position 		= 'absolute';
		div[1].style.top 			= this.Top;
		if(this.marginTop != 'no'){ 
		div[1].style.marginTop 		= '30px';
		}
		div[1].style.left 			= '50%';
		div[1].style.marginLeft 	= "-"+(parseFloat(this.popupWidth) / 2)+'px';
		div[1].style._height 		= '200px';
		div[1].style.Minheight 		= '200px';
		div[1].style.width 			= this.popupWidth+'px';
		div[1].style.background 	= '#FFFFFF';
		div[1].style.border			= '1px solid '+this.line;
		if(this.noOnclkTXT == ""){
		div[1].onclick				= this.CloseDiv.bind(this);
		}
	
		div[2] = this.doc.createElement("div");
		div[2].style.position 		= 'relative';
		div[2].style.clear 			= 'both';
		div[2].style.background 	= '#FFFFFF';
		div[2].style.width 			= (parseFloat(this.popupWidth) - 10)+"px";
		div[2].style.font			= '10px verdana, arial';
		div[2].style.color			= '#000000';
		div[2].style.textAlign		= 'left';
		div[2].style.padding 		= '5px';
	
		div[3] = this.doc.createElement("div");
		div[3].id 					= 'picDiv3';
		div[3].style.position 		= 'absolute';
		div[3].style.top 			= '-20';
		div[3].style.right 			= '-1';
		div[3].style.width 			= parseFloat(this.popupWidth)+"px";
		div[3].style.marginLeft 	= '-1';
		div[3].style.height 		= '19';
		div[3].style.paddingTop 	= '1';
		div[3].style.textAlign		= 'left';
		div[3].style.font			= '10px verdana, arial';
		div[3].style.color			= this.darktext;
		div[3].style.lineHeight		= '17px';
		div[3].style.backgroundColor= this.bgC;
		div[3].style.textAlign 		= 'right';
		div[3].style.borderTop 		= '1px solid '+this.line;
		div[3].style.borderLeft 	= '1px solid '+this.line;
		div[3].style.borderRight 	= '1px solid '+this.line;
		div[3].style.fontSize 		= '13';
		div[3].style.zIndex 		= 10; 
	
		div[4] = this.doc.createElement("div");
		div[4].id 					= 'picDiv3';
		div[4].style.position 		= 'absolute';
		div[4].style.top 			= '-20';
		div[4].style.right 			= '-1';
		div[4].style.width 			= '20';
		div[4].style.marginLeft 	= '-1';
		div[4].style.height 		= '19';
		div[4].style.paddingTop 	= '1';
		div[4].style.paddingRight 	= '5';
		div[4].style.textAlign 		= 'right';
		div[4].style.font			= '10px verdana, arial';
		div[4].style.color			= this.darktext;
		div[4].style.fontWeight		= 'bolder';
		div[4].style.fontSize 		= '13';
		div[4].style.cursor 		= 'pointer';
		div[4].style.zIndex 		= 11; 
		div[4].style.color	 		= this.darktext; 
		div[4].onclick				= this.CloseDiv.bind(this);
		
		div[5] = this.doc.createElement("div");
		div[5].style.position 		= 'absolute';
		div[5].style.top 			= '-20';
		div[5].style.left 			= '0';
		div[5].style.width 			= '85%';
		div[5].style.height 		= '19';
		div[5].style.paddingTop 	= '1';
		div[5].style.paddingLeft 	= '5';
		div[5].style.textAlign 		= 'left';
		div[5].style.font			= '10px verdana, arial';
		div[5].style.fontWeight		= 'bolder';
		div[5].style.color			= this.darktext;
		div[5].style.fontSize 		= '13';
		div[5].style.cursor 		= 'pointer';
		div[5].style.zIndex 		= 12; 
		
		var title 					= this.doc.createTextNode(this.title); 
		var close 					= this.doc.createTextNode("X"); 
	
		if(this.type == "text"){
			for(i=0;i<this.arr_text.length;i++){
			text[i]						= this.doc.createTextNode(this.arr_text[i]); 
			br[i]						= this.doc.createElement("br"); 
			div[2].appendChild(text[i]);
			div[2].appendChild(br[i]);
			}
		}else if(this.type == "html"){
			div[2].innerHTML			= this.text;		
		}
		
		div[4].appendChild(close);
		div[5].appendChild(title);
		div[1].appendChild(div[3]);
		div[1].appendChild(div[2]);
		div[1].appendChild(div[4]);
		div[1].appendChild(div[5]);
		this.div = div;
		if(typeof(window.onload) == "object" || this.onload == 'no'){
		this.body.appendChild(this.div[0]);
		this.body.appendChild(this.div[1]);
		}else{
		window.onload = this.loading.bind(this);
		}
	}
};

CreatePopupDiv.prototype.loading = function()
{
	this.body.appendChild(this.div[0]);
	this.body.appendChild(this.div[1]);
	try{
		if (window.parent.vulin.processing){
	    window.parent.vulin.processing.close();
	    }
	}catch(excp){}
};

CreatePopupDiv.prototype.CloseDiv = function()
{
	this.click++;
	this.tDate 		= new Date();
	this.stop				 	= this.tDate.getHours() + "" + this.tDate.getMinutes() + ""  + this.tDate.getSeconds();
	if((parseFloat(this.stop) - parseFloat(this.start) > 1) || this.click >= 5){
		for(i=0;i<2;i++){
			this.body.removeChild(this.doc.getElementById('picDiv'+i));
		}
	}
	(this.xtr_js != '')?eval(this.xtr_js):"";
	if(this.back == 'Y'){
	history.back();
	}
};

if(!Function.prototype.bind) {
	Function.prototype.bind = function(object) {
		var __method = this;
		return function() {
			return __method.apply(object, arguments);
		}
	}
}

if( ! Function.prototype.bindMore ) {
	Function.prototype.bindMore = function( object )
	{
		var __method	= this;
		var __arguments	= [];
		for( var i = 1 ; i < arguments.length ; i++ ) {
			__arguments.push( arguments[i] );
		}

		return function() {
			return __method.apply( object , __arguments );
		}
	};
}

