﻿// JScript File

var exit=true;
function exitwindow()
{
if(getCookie('onlyOnce') == 'true')
   exit = false;
var url = 'start_survey.html';
var win = 'toolbar=0,directories=0,menubar=0,scrollbars=0,resizable=0,width=320,height=315';
if (exit)
{
  setCookie('onlyOnce','true',1);
  open(url,'Feedback',win); 
  
}
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function showSurveyDiv()
{
	if(getCookie('onlyOnce2') != 'true') {
		document.getElementById('popup').style.display = 'block';
	}
}

addLoadEvent(delayPopupOpen);
setTimeout('showSurveyDiv()',4000);
function delayPopupOpen()
{
	
	setTimeout('showSurveyDiv()',1000);
}

function hideSurveyPopup()
{
	setCookie('onlyOnce2','true',1);
    document.getElementById('popup').style.display = 'none';
}
	
	
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}	