
/*******************************************************************************
Popup Window openers
*******************************************************************************/
var base_href='';var winReference=null;function openPositionedWindow(url,name,width,height,x,y,status,scrollbars,moreProperties,openerName){var agent=navigator.userAgent.toLowerCase();if(agent.indexOf("mac")!=-1&&agent.indexOf("msie")!=-1&&(agent.indexOf("msie 4")!=-1||agent.indexOf("msie 5.0")!=-1)){height+=(status)? 17:2;}
width+=(scrollbars!=''&&scrollbars!=null&&agent.indexOf("mac")==-1)? 16:0;var properties='width='+width+',height='+height+',screenX='+x+',screenY='+y+',left='+x+',top='+y+((status)? ',status':'')+',scrollbars'+((scrollbars)? '':'=no')+((moreProperties)? ','+moreProperties:'');var reference=openWindow(url,name,properties,openerName);return reference;}
function openCenteredWindow(url,name,width,height,status,scrollbars,moreProperties,openerName){var x,y=0;if(screen){x=(screen.availWidth-width)/2;y=(screen.availHeight-height)/2;}
if(!status)status='';if(!openerName)openerName='';var reference=openPositionedWindow(url,name,width,height,x,y,status,scrollbars,moreProperties,openerName);return reference;}
function openCenteredOnOpenerWindow(url,name,width,height,status,scrollbars,moreProperties,openerName){var centerX=0;var centerY=0;if(window.screenX!=null&&window.outerWidth){centerX=window.screenX+(window.outerWidth/2);centerY=window.screenY+(window.outerHeight/2);}
else if(window.screenLeft){if(document.documentElement){centerX=window.screenLeft+(document.documentElement.offsetWidth/2);centerY=window.screenTop+(document.documentElement.offsetHeight/2);}
else if(document.body&&document.body.offsetWidth){centerX=window.screenLeft+(document.body.offsetWidth/2);centerY=window.screenTop+(document.body.offsetHeight/2);}
}
if(centerX==0){openCenteredWindow(url,name,width,height,status,scrollbars,moreProperties,openerName);}
var x=parseInt(centerX-(width/2));var y=parseInt(centerY-(height/2));if(!status)status='';if(!openerName)openerName='';var reference=openPositionedWindow(url,name,width,height,x,y,status,scrollbars,moreProperties,openerName);return reference;}
function openMaxedWindow(url,name,scrollbars,openerName){var x,y=0;var width=600;var height=800;if(screen){if(screen.availLeft){x=screen.availLeft;y=screen.availTop;}
width=screen.availWidth-6;height=screen.availHeight-29;}
var reference=openPositionedWindow(url,name,width,height,x,y,false,scrollbars,openerName);return reference;}
function openFullChromeWindow(url,name,openerName){return openWindow(url,name,'directories,location,menubar,resizable,scrollbars,status,toolbar');}
function openSizedFullChromeWindow(url,name,width,height,openerName){return openCenteredWindow(url,name,width,height,true,true,'directories,location,menubar,resizable,toolbar',openerName)
}
function openWindow(url,name,properties,openerName){var agent=navigator.userAgent.toLowerCase();if(agent.indexOf("msie")!=-1&&parseInt(navigator.appVersion)==4&&agent.indexOf("msie 5")==-1&&agent.indexOf("msie5")==-1&&agent.indexOf("win")!=-1&&url.indexOf('http://')==0){winReference=window.open('about:blank',name,properties);setTimeout('if (winReference && !winReference.closed) winReference.location.replace("'+url+'")',300);}
else{winReference=window.open(url,name,properties);}
setTimeout('if (winReference && !winReference.closed) winReference.focus()',200);if(openerName)self.name=openerName;return winReference;}
/*******************************************************************************
Modal Dialog controls
*******************************************************************************/
function closeDialog(dialog){if(dialog&&dialog.closed!=true)dialog.close();}
function closeParentDialog(){if(top.opener&&isWindowPopup(top.opener)){root=top.opener.top.opener;top.opener.close();top.opener=root;}
}
function isWindowPopup(win){return((win.opener)? true:false);}
/*******************************************************************************
	Additional functions
*******************************************************************************/
function openImagePopupID(id,width,height,title,idefic,params){if(typeof(idefic)=='undefined')idefic='i';if(typeof(params)=='undefined')params='';var url=base_href+'get.php?'+idefic+'.'+id+':h.'+height+':w.'+width+params;return openImagePopup(url,width,height,"image_"+id,title,0);}
function openFlashPopupID(id,width,height,title){var url=base_href+'get.php?s.'+id;return openImagePopup(url,width,height,"image_"+id,title,1);}
function openImagePopup(url,width,height,window_name,title,flash){if(title+""=="undefined"){title="-";}
win=openCenteredWindow("",window_name,parseInt(width),parseInt(height),0,0,"");var body="<html><head><title>"+title+"</title></head><meta http-equiv=\"imagetoolbar\" content=\"no\"><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>";if(!flash){body+="<img style=\"\" onclick=\"window.close();\" alt=\"\" src=\""+url+"\">";}
else{body+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="menu" value="false"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+width+' height='+height+'></embed></object>';}
body+="</body></html>";win.document.write(body);win.document.close();return false;}
function openImagePopupCentered(url,width,height,window_name,title,flash){if(title+""=="undefined"){title="-";}
win=openCenteredWindow("",window_name,parseInt(width),parseInt(height),0,0,"");var body="<html><head><title>"+title+"</title></head><meta http-equiv=\"imagetoolbar\" content=\"no\"><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>";if(!flash){body+="<table width=\"100%\" height=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"center\" valign=\"center\"><img style=\"\" onclick=\"window.close();\" alt=\"\" src=\""+url+"\"></td></tr></table>";}
else{body+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="menu" value="false"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+width+' height='+height+'></embed></object>';}
body+="</body></html>";win.document.write(body);win.document.close();return false;}
function openWinInModal(url,width,height,params,title,charset){url=base_href+"index.php?page=services/window_frame&title="+escape(title)+"&charset="+charset+"&url="+escape(url);return openDialog(url,width,height,params,params["scrollbars"],params["resizable"]);}
function openDialog(url,width,height,param,scroll,resizable){if(scroll+""=="undefined"){scroll=0}
if(resizable+""=="undefined"){resizable=0}
var rnd=Math.round((Math.random()*999)+1);var r=showModalDialog(url+"&r="+rnd,param,'dialogWidth:'+width+'px;dialogHeight:'+height+'px;center:1;dialogHide:0;help:0;edge:raised;status:0;unadorned:1;resizable:'+resizable+';scroll:'+scroll);if(typeof(r)!="undefined")
return r;else
return true;}
function IsPopupBlocker(){var oWin=window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");if(oWin==null||typeof(oWin)=="undefined"){return true;}else{oWin.close();return false;}
}
