/******************************************
YES CONFIRMBOX

author: mario aspeleiter <m.aspeleiter@yes-websolutions.de>
copyright: mario aspeleiter <m.aspeleiter@yes-websolutions.de>

******************************************/


function yes_confirmbox(msg,target_link,w,h) {
  this.html_template = '';
  this.window_id = 'yes_confirmbox';
  this.msg = msg;
  this.target_link = target_link;
  this.width = w;
  this.height = h;
  this.top = 200;
  this.left = 200;
  this.showConfirm = showConfirm;
  this.getConfirmHTML = getConfirmHTML;
  this.resizable = 'yes';
  this.scrollbars = 'yes';
  //This next line uses an alternative syntax
  this.retCirc = function () { return ( Math.PI * this.radius * 2 ); };
}

function showConfirm() {
	ymbW = window.open(this.html_template,this.window_id,'width='+this.width+',height='+this.height+',resizable='+this.resizable+',scrollbars='+this.scrollbars+',top='+this.top+',left='+this.left);
	ymbW.document.write( this.getConfirmHTML() );
	ymbW.document.close();
	ymbW.focus();
}

function getConfirmHTML(){
	var HTML  = "<html>\r\n";
	HTML += "	<head>\r\n";
	HTML += "		<title>"+YES_JS_CONFIRMBOX_TITLE+"</title>\r\n";
	HTML += "		<link rel=\"stylesheet\" type=\"text/css\" href=\"includes/stylesheet.css\" />\r\n";
	HTML += "	</head>\r\n";
	HTML += "	<body style=\"background-color: #9999FF;margin:0px;padding:0px;\">\r\n";
	HTML += "	<div align=\"center\" class=\"yes_alertbox_title\">"+YES_JS_CONFIRMBOX_TITLE+"</div>\r\n";
	HTML += "	<div align=\"center\" class=\"yes_alertbox\">\r\n";
	HTML += "	"+this.msg+"\r\n";
	HTML += "	</div>\r\n";
	HTML += "	<div align=\"center\" style=\"padding:10px;\">\r\n";
	HTML += "	<input type=\"button\" class=\"ibutton\" style=\"width:130px;\" value=\""+YES_JS_CANCEL+"\" title=\""+YES_JS_CANCEL+"\" onclick=\"window.close();\" />\r\n";
	HTML += "	&nbsp;<input type=\"button\" class=\"ibutton\" style=\"width:130px;\" value=\""+YES_JS_OK+"\" title=\""+YES_JS_OK+"\" onclick=\"opener.window.location.href='"+this.target_link+"';window.close();\" />\r\n";
	HTML += "	</div>\r\n";
	HTML += "	</body>\r\n";
	HTML += "</html>";
	return HTML;
}

function show_yes_confirmbox(msg,target_link,w,h){
	ycb = new yes_confirmbox(msg,target_link,w,h);
	ycb.showConfirm();
}

