<!--

function open_window(url,name,para) { 
window.open(url,name,para);
//window.location.reload();
//window.close(); 
}
var xptemplate;
var xpclasscode;
var popupWindow;
function xpinstallCallback(url, status) 
{
	if (status == 0) {
		//alert(xptemplate);
		navigator.plugins.refresh();
		showDialogorder(xptemplate,xpclasscode,"");
	}
}

function install (templates, classcode) 
{
	xptemplate = templates;
	xpclasscode = classcode;
	var xpi = {'PrintCreationsX.xpi':'./Cab/PrintCreationsX.xpi'};
	InstallTrigger.install(xpi,xpinstallCallback);
}

function mygetcookie(templates)
{
	var search=templates+"=";
	var ret = "";
	if(document.cookie.length > 0)
	{
		var start = -1;
		var end = -1;
		var i;
		var cookievalue=document.cookie.split(";");
		for(i=0;i<cookievalue.length;i++)
		{		
			start = cookievalue[i].indexOf(templates);
			if(start == 0)
			{
				start = start + templates.length + 1;
				end = cookievalue[i].length;
				ret = unescape(cookievalue[i].substring(start,end));
				return ret;
			}
		}
	}
	return "";
}

function mygetcookieie(templates)
{
	var search=templates+"=";
	var isopen = "";
	if(document.cookie.length > 0)
	{
		var start = -1;
		var end = -1;
		var i;
		var cookievalue=document.cookie.split(";");
		for(i=0;i<cookievalue.length;i++)
		{		
			start = cookievalue[i].indexOf(templates);
			if(start == 0)
			{
				start = start + templates.length + 1;
				end = cookievalue[i].length;
				isopen = unescape(cookievalue[i].substring(start,end));
				return isopen;
			}
		}
	}
	return "";
}

var winprint;

function showDialogorder(templates,classcode,fileDirMac,retailerid)
{
	//alert(templates);
	//if(emailaddress||emailaddress!="")
	//classcode=classcode+"*"+emailaddress;
	var zhi="";

	//alert("aaa");
	var userAgent = navigator.userAgent;
	if( navigator.platform == "Win32" || navigator.platform == "Win64")
	{
		
		if( userAgent.indexOf("MSIE")>=1 )
		{
				//alert("An instance of the plugin is already running. Please exit before launching it again.");
				var hei = screen.height;
				var wid = screen.width;
				//var obj = document.all("printcreationsx");
				//obj = navigator.plugins["PrintCreations.PrintCreationsX"];		 
				//var obj = navigator.plugins["Shockwave Flash object"];	
					 
		     
				//templates = hereUrl.value + templates;(no use local)
				//window.showModalDialog("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode, "ArcSoft Print Creations Online Demo", "dialogHeight="+hei+"px; dialogWidth="+wid+"px; center = yes; scroll = no; status = no; help = no");
				//temp=document.getElementById("isready").value;
				//alert(templates);
				var isopen=mygetcookieie("printcreationwindowisopen");
				if( isopen == "yes" )//document.getElementById("isready").value ==1 
				{
				//alert("The program can not open again before you end the opening!");
					if(popupWindow == null || popupWindow.closed)
					{alert("An instance of the plugin is already running. Please exit before launching it again.");}
					else
					{
					alert("An instance of the plugin is already running. Please exit before launching it again.");
					popupWindow.focus();}
				//window.open("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode,"","toolbars=no,location=no,scrollbars=no,status=no,resizable=no,width="+wid+"px,height="+hei+"px");
				}
				else if(popupWindow == null || popupWindow.closed)
				{
					
					if(zhi||zhi!="") 
						var url="TemplatePanel.asp";
					else
						var url="http://www.printcreations.com/onlineorderapp/TemplatePanel.asp";
						//alert(window.parent.location.hostname)
						
						//alert(url)
				popupWindow = window.open(""+url+"?temURL="+templates+"&temClass="+classcode+"&temClassid="+fileDirMac+"&retailerid="+retailerid,"","top=0, left=0,center=yes,toolbars=no,location=no,scrollbars=no,status=no,width="+wid+"px,height="+hei+"px");//channelmode=yes,fullscreen=yes,resizable=no,
				//document.getElementById("isready").value = 1;
				//document.cookie="printcreationwindowisopen=yes";  all add in the next pages
				//popupWindow = window.open('TemplatePanel.asp',);
				}
				else
				{
					//alert("The window is opened all!");
					alert("An instance of the plugin is already running. Please exit before launching it again.");
					//winprint.focus();
				}
				//window.open("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode,"ArcSot Print Creations Online Demo","width="+wid+"px,height="+hei+"px,top=0,left=0,modal=yes,resizable=no,scrollbars=no,help=no");
				
				//window.open('InstallUpgradeActiveX.asp','','toolbars=no,location=no,scrollbars=no,status=no,resizable=no,width=1000,height=650');
				/* crash the download
				if(isobj)//obj==undefined  .IStartup('', '', '')
				{//window.open('test.asp','','toolbars=no,location=no,scrollbars=no,status=no,resizable=no,width=1000,height=650');
				window.showModalDialog("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode, "ArcSoft Print Creations Online Demo", "dialogHeight="+hei+"px; dialogWidth="+wid+"px; center = yes; scroll = no; status = no; help = no");
				//alert("yes install");
				}
				else
				{
				//alert("no install");
				window.open('InstallUpgradeActiveX.asp','','toolbars=no,location=no,scrollbars=no,status=no,resizable=no,width=1000,height=650');
				//window.showModalDialog("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode, "ArcSoft Print Creations Online Demo", "dialogHeight="+hei+"px; dialogWidth="+wid+"px; center = yes; scroll = no; status = no; help = no");
				}*/				
		}
		else if(userAgent.indexOf("Firefox") >= 1)
		{
			//if((userAgent.indexOf("Firefox/3.0") >= 1) && (userAgent.indexOf("NT 6.0") >= 1))
//			{
//				alert("The web browser you are using in Vista OS is not supported.  We recommend you use Internet Explorer to order books online.");
//			}
//			else
//			{
			var printcreationsplugin = navigator.mimeTypes["application/x-PrCrXWebkit"];
			if(printcreationsplugin)
			{
				var x= screen.width;
				var y= screen.height;
				//templates = document.getElementById("UrlId").value + templates;
				var ret=mygetcookie("printcreationwindowisopen");
				if(ret == "yes")
				{
				    alert("An instance of the plugin is already running. Please exit before launching it again.");
					//alert("The window is opened!");  always go into this but after minsize it will be no effect
					winprint.focus();
					//alert("The window is opened!");
				}
				else if(winprint == null || winprint.closed)
				{
					
					if(zhi||zhi!="") 
						var url="TemplatePanel2.asp";
					else
						var url="http://www.printcreations.com/onlineorderapp/TemplatePanel2.asp";
					
					//document.cookie="printcreationwindowisopen=yes";  all add in the next pages 0610
					//if(zhi||zhi!="")
					winprint = window.open(""+url+"?temURL="+templates+"&temClass="+classcode+"&temClassid="+fileDirMac+"&retailerid="+retailerid,"ArcSot Print Creations Online Demo","width="+x+"px,height="+y+"px,top=0,left=0,modal=yes,resizable=no,scrollbars=no,help=no");
					//else
					//winprint = window.open("TemplatePanel2.asp?temURL="+templates+"&temClass="+classcode+"&temClassid="+fileDirMac+"&retailerid="+retailerid,"ArcSot Print Creations Online Demo","width="+x+"px,height="+y+"px,top=0,left=0,modal=yes,resizable=no,scrollbars=no,help=no");
				}
				else
				{
					//alert("An instance of the plugin is already running. Please exit before launching it again.");
					alert("The window is opened!");
					//winprint.focus();
					//alert("The window is opened!");
				}
			}
			else
			{
				//var truthBeTold = confirm("Install printcreations plugin now ?");
				//if (truthBeTold) 
				//{
				//	install(templates,classcode);
				//}
				//alert("Please install the plugin first!");   //firefox not  install  should be show this
				InstallPlugin(0);
			}
			//} delete 3.0 strict
		}
		else
		{
			alert("This site requires IE6 or higher, or Firefox 1.5 or higher.");
		}
	}
	else if( document.getElementById("idIsMac").value =="1" )
	{
		//alert("Sorry. This Plugin is not supported in MAC OS.  We recommend you order books online in Windows OS.");
		if( userAgent.indexOf("Safari")>=1 )
		{
             templatesMac = document.getElementById("UrlId").value + templates;
			download(templatesMac,classcode,fileDirMac);		
		}
		else if(userAgent.indexOf("Firefox") >= 1)
		{
			templatesMac = document.getElementById("UrlId").value + templates;
			downloadex(templatesMac,classcode,fileDirMac);
		}
		else
		{
			alert("This site requires Safari 1.4 or higher, or Firefox 1.5 or higher.");
		}
	}
	else
	{
		alert("This site need windows or mac OS");
	}
	/*
            var browser=navigator.appName
            var b_version=navigator.appVersion
            var version=parseFloat(b_version)
            if( browser=="Microsoft Internet Explorer")
            {
				var hei = screen.height;
				var wid = screen.width;		 
		     
				templates = hereUrl.value + templates;
				window.showModalDialog("TemplatePanel.asp?temURL="+templates+"&temClass="+classcode, "ArcSoft Print Creations Online Demo", "dialogHeight="+hei+"px; dialogWidth="+wid+"px; center = yes; scroll = no; status = no; help = no");		
             }
              else if(browser == "Netscape")
              {         
                    //templatePos =templates.indexOf('/templates/',0);
                    //alert(document.getElementById("UrlId").value);
                templatesMac = document.getElementById("UrlId").value + templates;
				download(templatesMac,classcode,fileDirMac);
             }
	*/
}	

function InstallPlugin(bMac)
{
      //var browser=navigator.appName;
	  
	  var userAgent = navigator.userAgent;
	  
	  if( bMac )
	  {
			//alert("Sorry. This Plugin is not supported in MAC OS.  We recommend you order books online in Windows OS.");
			if( userAgent.indexOf("Safari")>=1 )		  
			{
				window.open( "MacPlugIn.asp","plugin","width=900,height=700,scrollbars=1");	    
			}
			else if(userAgent.indexOf("Firefox") >= 1)
			{
				window.open( "MacPluginfox.asp","plugin","width=900,height=700,scrollbars=1");	
			}
			else
			{
				alert("This site requires Safari 1.4 or higher.");
			}	  
	  }
	  else if( navigator.platform == "Win32" || navigator.platform == "Win64")
	  {
			if( userAgent.indexOf("MSIE")>=1 )		  
			{
				if(zhi||zhi!="") 
				window.open( "InstallUpgradeActiveX.asp","plugin","width=900,height=700,scrollbars=1");	
				else
				window.open( "../../onlineorderapp/InstallUpgradeActiveX.asp","plugin","width=900,height=700,scrollbars=1");	
				
			}
			else if(userAgent.indexOf("Firefox") >= 1)
			{
				/*if((userAgent.indexOf("Firefox/3.0") >= 1) && (userAgent.indexOf("NT 6.0") >= 1))
				{
				alert("The web browser you are using in Vista OS is not supported.  We recommend you use Internet Explorer to order books online.");
				}
				else
				{*/
				if(zhi||zhi!="")
				window.open( "InstallUpgradePlugin.asp","plugin","width=900,height=700,scrollbars=1");
				else
				window.open( "../../onlineorderapp/InstallUpgradePlugin.asp","plugin","width=900,height=700,scrollbars=1");
				//}			
			}
			else
			{
				alert("This site requires IE6 or higher, or Firefox 1.5 or higher.");
			}
	  }
	  else
	  {
			alert("This site need windows or mac OS.");
	  }
}
-->