var is_internal_link=true;
var isExit=is_internal_link;

var ver = getInternetExplorerVersion();    
msg = "You are using Internet Explorer."+ver;    
	

	
function igoto(txtvalue) 
{ 
		is_internal_link=false;
		isExit=false;
		window.location=txtvalue;
}
			
			
function exitwindow_alt()
{
		var url = 'survey.html';
		var win = 'toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=0,width=450,height=900';
		if (is_internal_link)
		open(url,'WindowName',win);
}
	
	
	
function getInternetExplorerVersion() 
{    var rv = -1; 
	// Return value assumes failure.    
	if (navigator.appName == 'Microsoft Internet Explorer')
	{        
		var ua = navigator.userAgent;       
		var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");        
		if (re.exec(ua) != null)            
		rv = parseFloat(RegExp.$1);    
	}    
	return rv;
}



if (ver<10)
{	
		function exitwindow()
		{
			var url = 'survey.html';
			var win = 'toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=0,width=450,height=900';
			if (is_internal_link)
			{
				isExit=is_internal_link;
				open(url,'WindowName',win);
			}
		}
}


if (ver>17)
{
					var ExitPopURL = 'survey.html'; //This is the URL where your 'exit page' is located.
					var AlertBox = "請按'取消'回答我們的問卷調查,或按'確定'離開本站."; 
			
						window.onload = function()
						{
							// this is where we start our journey...
							 createExitPop();
						}// end function onunload
								
								function ajaxGET(divId, page, effect) 
								{ 
									 var xmlHttp; 
									 try 
									{ 
										 // Firefox, Opera 8.0+, Safari 
										 xmlHttp=new XMLHttpRequest(); 
									} 
									 catch(e)   
									{ 
										 // Internet Explorer 
										 try 
										 { 
											  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
										 } 
										 catch(e)   
										  { 
											   try 
											   { 
													xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
											   } 
											   catch(e)   
											 {      
													alert("Your browser does not support AJAX!"); 
												  return false; 
											 } 
										 } 
									 } 
									  
									xmlHttp.onreadystatechange=function() 
									 { 
										 if(xmlHttp.readyState==4) 
										  { 
											   if(effect == 'collapse') 
												   { 
												   		document.getElementById(divId).style.display='none'; 
													} 
												   else                    
												   { 
												   		document.getElementById(divId).innerHTML=xmlHttp.responseText;
													} 
										 } 
									} 
									 xmlHttp.open("GET",page,true); 
									xmlHttp.send(null); 
								}
								
								function createExitPop()
								{
								
									var theBody = document.getElementsByTagName('body')[0]; 
									var newdiv = document.createElement('div');
									newdiv.setAttribute('id','ExitDiv');
									theBody.setAttribute('id','body');
									newdiv.setAttribute('style', 'width: 100%; height: 100%;');

									// put div on page
									theBody.appendChild(newdiv);
									
									//add exit pop to page (contents are from your exit.php(or whatever you named it) page)	
														
									
									// style exit pop to resemble its own page
									document.getElementById('ExitDiv').style.display = "none"; 
									document.getElementById('ExitDiv').style.top = '0px'; 
									document.getElementById('ExitDiv').style.left = '0px'; 
									document.getElementById('ExitDiv').style.position = 'relative';
									document.getElementById('ExitDiv').style.backgroundColor = '#FFFFFF';
									document.getElementById('ExitDiv').background.URL = "images\common\survey.jpg";
								}// end createExitPop
								
								isExit = true;
								
								function ExitPop(isExit)
								{
									
										if(isExit != false)	
										{
											window.location = ExitPopURL;
											isExit=false;
											isPop = true;
											
											var bodyTag = document.getElementById? document.getElementsByTagName("BODY")[0] : document.body;
											
											// add id="body" so that it can be referenced.
											bodyTag.setAttribute("id", "body");
											
											//replace body text with exit pop
											bodyTag.innerHTML = document.getElementById('ExitDiv').innerHTML;
											return AlertBox;
										} // end if
								}// end function
								window.onbeforeunload = function()
								{
										// Lay down an exit pop!!
										return ExitPop(isExit);
								}// end function onunload
}






