
var __IE__=1; // IE
if(navigator.userAgent.indexOf('Gecko') != -1){__IE__=0;} // MOZILLA

isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=window.opera && isDOM //Opera 5+
isOpera6=isOpera && window.print //Opera 6+
isOpera7=isOpera && document.readyState //Opera 7+
//alert (isOpera7);

function positionWindow(width, height, event)
{
	var winWidth =screen.width
	var winHeight=screen.height
	if(event == null){
		var left= 150
		var top = 150
	}else{
		var left= event.screenX+15
		var top = event.screenY+15
	}
	if((left+width)>winWidth){left=winWidth-width-10;}
	if((top+height+100)>winHeight){top=winHeight-height-100;}
	return new Array(left,top);
}

function FullPreview (url, width, height){
/*
	var url = "/rubricator/photo/voting_popup.html?photo_id=<!--{$photo_info.id}-->";
	var width = 600;
	var height = 500;
*/
	//alert ("URL"+url);

	try {
		if (GLOB_POPUP_PIC_NUMBER > 0 ){
			var tmp= "&pic_id="+GLOB_POPUP_PIC_ID;
			url +=tmp;
		}
	}catch (e){
		
	}


	var event = null;
	var aXY=positionWindow(width, height, event);

	if (isOpera7){
		var cBaseUrl=new String(window.location);
		var a=cBaseUrl.split('/');
		cBaseUrl='';
		for(var n=0; n<a.length-1; n++){cBaseUrl+=a[n]+'/';}
		//alert(cBaseUrl+url);
		var win=window.open(url, "extreme2", "modal,width="+width+",height="+height+",left="+aXY[0]+",top="+aXY[1]+',resizable=no,status=no"')
		return win;
	}else	if(__IE__== 1){
		//alert("IE");
		var cBaseUrl=new String(window.location);
		var a=cBaseUrl.split('/');
		cBaseUrl='';
		for(var n=0; n<a.length-1; n++){cBaseUrl+=a[n]+'/';}
		url = url;
		//alert (url);

		height+=40;
		window.showModalDialog(url,
			window,"dialogHeight: "+height+"px; dialogWidth: "+width+
			"px; dialogLeft: "+aXY[0]+"px; dialogTop: "+aXY[1]+
			"; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll:no; unadorned; no");
	}
	else{
		var cBaseUrl=new String(window.location);
		var a=cBaseUrl.split('/');
		cBaseUrl='';
		for(var n=0; n<a.length-1; n++){cBaseUrl+=a[n]+'/';}
		//alert(cBaseUrl+url);
		var win=window.open(url, "extreme2", "modal,width="+width+",height="+height+",left="+aXY[0]+",top="+aXY[1]+',resizable=no,status=no"')
		return win;
	}
}
