function OpenTextPopup(url) {
	var rnd = (Math.round((Math.random()*999)+1));
	var width=750;
	var height=450;
	var top=Math.round((screen.height-height)/2);
	var left=Math.round((screen.width-width)/2);
	this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
}
function OpenImagePopup(url,width,height) {

	var rnd = (Math.round((Math.random()*999)+1));
	var top=Math.round((screen.height-height)/2);
	var left=Math.round((screen.width-width)/2);
	this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}
function OpenOrder(id) {
	var rnd = (Math.round((Math.random()*999)+1));
	var width=600;
	var height=600;
	var top=10;
	var left=10;
	this.open( BASE_URL+"order.php"+id, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
}
function OpenPopupWindow(url,width,height) { OpenImagePopup(url,width,height); }

function OpenImagePopupID(id,width,height) {
	OpenImagePopup(CMS_URL+id,width,height);
}
function OpenPrintWindow(url,width,height) {

	var rnd = (Math.round((Math.random()*999)+1));
	var top=Math.round((screen.height-height)/2);
	var left=Math.round((screen.width-width)/2);
	this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
}
function openlangaz(f,w,h) {
	var nwin=window.open(f,"nanaoho",'width=' + w + ',height=' + h + ',resizable=0,scrollbars=no,menubar=no');
}
function OpenNewsTicketPopup(url) {
	var rnd = (Math.round((Math.random()*999)+1));
    if( screen.width > 1000 ){
    	var width=900;
	    var height=500;
    } else {
    	var width=750;
	    var height=450;
    }
	var top=50;
	var left=50;
	this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
}

function OpenImagePopupIDAuth(id,width,height) {
	createImagePopupWindow('Image', BASE_URL+'autoriai/editor.images.get.php?id='+id, width, height);
//	OpenImagePopup(BASE_URL+'autoriai/editor.images.get.php?id='+id,width+26,height+26);
}


function createImagePopupWindow(title,src, width, height)
{
	TheNewWin = window.open('','image','height='+height+',width='+width+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); 
	TheNewWin.moveTo(100,100);
	TheNewWin.document.write('<?xml version="1.0"?><!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN"');
	TheNewWin.document.write('"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd"><html xmlns="http:\/\/www.w3.org\/1999\/xhtml">');
	TheNewWin.document.write('<head><title>'+title+'<\/title>');
	TheNewWin.document.write('<\/head><body style="margin:0px;">');
	TheNewWin.document.write('<a href="#" onClick="window.close();"><img src="'+src+'" border="0" alt="'+title+'" \/>');
	TheNewWin.document.write('<\/body><\/html>');
	TheNewWin.focus();
}