﻿var str = "";
var strText = "";
var strSubject = "";

    window.onload = WindowLoad;
    function WindowLoad() 
    {
        
		//document.getElementById("visited").value = "View";
        
    }

    function SetValue() 
    {
        //document.getElementById("visited").value = "Submit";
     
    }

    window.onbeforeunload = ConfirmExit;
    function ConfirmExit() 
    {
        if ( ! get_cookie ( "MNI_LoggedIn" ) )
		{
			var cookie_date = new Date ( );  // current date & time
			//alert(cookie_date.toGMTString());
			//1 min = 60000
			//1 hr = 60 * 60000
			//1 day = 24 * 60 * 60000
			//30 days = 30 * 24 * 60 * 60000 = 2592000000
			cookie_date.setTime ( cookie_date.getTime() + 2592000000 );
			//alert(cookie_date.toGMTString());
			document.cookie = "MNI_LoggedIn=" + escape("Yes") + ";expires=" + cookie_date.toGMTString();
			window.open("http://www.surveymonkey.com/s/7VY5T7X");
			//set_cookie ("MNI_LoggedIn", "Test", cookie_date.toGMTString(); );
			//alert("To help serve you better in the future, please fill out our question survey, thanks!");
			
		}
    }
	
	function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
	{
	  var cookie_string = name + "=" + escape ( value );

	  if ( exp_y )
	  {
		var expires = new Date ( exp_y, exp_m, exp_d );
		cookie_string += "; expires=" + expires.toGMTString();
	  }

	  if ( path )
			cookie_string += "; path=" + escape ( path );

	  if ( domain )
			cookie_string += "; domain=" + escape ( domain );
	  
	  if ( secure )
			cookie_string += "; secure";
	  
	  document.cookie = cookie_string;
	}
	
	function get_cookie ( cookie_name )
	{
	  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

	  if ( results )
		return ( unescape ( results[2] ) );
	  else
		return null;
	}
	
	function delete_cookie ( cookie_name )
	{
	  var cookie_date = new Date ( );  // current date & time
	  cookie_date.setTime ( cookie_date.getTime() - 1 );
	  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
	}




