// JavaScript Document
var my_window;



function popup01(theURL,winName,features)
 { //v2.0
	my_window=window.open(theURL,winName,features);
	if (window.focus) {my_window.focus()}
}


function ClosePopup(theURL,winName,features)
 { //v2.0
    var ccT=window.open(theURL,winName,features);
	ccT.close();
}
/*function showmenufirst(strID){
    document.getElementById(strID).style.display="none";
    document.getElementById(strID+"0").style.display="block";
	
}

function hidemenufirst(strID){
	document.getElementById(strID).style.display="block";
	document.getElementById(strID+"0").style.display="none";

}*/

  
function showHide(weeklyID) 
{   
	var divs = document.getElementById('ShowHidePanel').getElementsByTagName('div'); 
	
    if(document.getElementById(weeklyID).style.display=="block")
	{
	    document.getElementById(weeklyID).style.display="none";
	}
	else if(document.getElementById(weeklyID).style.display=="none")
	{
	    HideAllPanels(divs.length /2);
	    document.getElementById(weeklyID).style.display="block";
	} 
}
function HideAllPanels(NoOfPanel)
{
    for(var i=1; i<=NoOfPanel;i++)
    {
        var listingID = document.getElementById("link"+i);
        if(listingID!=null)
        {
            listingID.style.display="none";
        }
    }
}
 
        

var ShouldUnload = false;
var uploadcall=false;
var refreshForm="";
window.onload = CheckString;
window.onunload = CheckStringcheck;
//window.onbeforeunload = CheckStringcheck;
//ChRefesh();
function CheckString() 
{
        var Arr_ControlsObj = document.getElementsByTagName('*');
         for (var Index = 0; Index < Arr_ControlsObj.length; Index++)
         {
            if (Arr_ControlsObj[Index].tagName.toLowerCase() == 'a')
            {
                Arr_ControlsObj[Index].onclick = SetValue;
            }
        }
}

function CheckStringcheck() {
    if (!ShouldUnload)
    {
//     if(refreshForm =="")
//     {
 
//  alert(getCookie('username'));
  //alert("See you soon" + ShouldUnload);
     //if (document.cookie==null || document.cookie=="")
     if(getCookie('username') == null || getCookie('username')=="")
        {
//            alert("See you soon");
            //uploadcall=true;
          
           // if (iX <=30 && iY < 0 )
          //  {
                popup01('feedbackform.aspx','popup','left=50,top=50,scrollbars=no,width=670,height=500,menubar=no');
                window.event.returnValue = false;
           // }
        }
//     }
//     else
//     {
//        refreshForm ="";
//     }
    }
}

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 closepopup()
{
try
{
            if(my_window) 
        {  
            my_window.close ();
        }
    
    }
    catch(Ex)
    {
    }
}


function SetValue() 
{
    ShouldUnload = true;
}

//function ChRefesh()
//{
//  if (document.all)
//{           
//     document.onkeydown = function ()
//     {
//             var key_f5 = 116; // 116 = F5          
//          if (key_f5==event.keyCode)
//          {
//               event.keyCode=0;
//               alert ("Refreshing has been disabled.");
//          }
//          return false;
//     }
//}

//}
//function CheckrefreshForm()
//{
//      refreshForm="0";
//}
//        
        

