﻿// JScript File

 /*delCookie('PushSiteLandCookie');
 delCookie('NoNeedToShowCookie');
 delCookie('NotBotheredCookie');*/
 
 var ff = getCookie('PushSiteLandCookie');
 var gg = getCookie('NoNeedToShowCookie');
 var hh = getCookie('NotBotheredCookie');
 //alert(ff);
 //alert(gg);
 //alert(hh);
 
 /*if (getCookie('PushSiteLandCookie') != null)
 {
    alert(getCookie(PushSiteLandCookie));
 }
 */
 

var test= document.location.href.split('/'); 

//alert(document.location.href);
//var locationdetails = document.location.href.split('//'); 
//alert(locationdetails[0]);
//alert(locationdetails[1]);
//alert(test[0]);
//alert(test[1]);
//alert(test[2]);
//alert(test[3]);
//var locationDetails1 = encodeURIComponent(locationdetails[1].split('/')); 
//alert (locationdetails1[0]);
//alert(locationdetails[2]);
//var applicationPath = locationdetails[0] + '//' + locationdetails[1]+ '/';
//alert(applicationPath);
var applicationPath = test[0] + '//' + test[2]+ '/';

 
 if (ff == 'PushSiteLandValue')
 {
    
    //alert('Value');
    
    if (gg != null)
    {
        if (gg == 'NoNeedToShowCookieValue')
        {
        
        }
        else
        {
            getBrowserDetails();
        }
    }
    
    
    if (hh != null)
    {
        if (hh == "NotBotheredCookieValue")
        {
            
        }
    }
    
    // Include the code for IE version < 6, FF < 2; Safari <3
    /*if (gg == null && hh == null)
    {      
        getBrowserDetails();
    }*/
    
 }
 else
 {

	getBrowserDetails();
 }
 
 


function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

} 


function delCookie (NameOfCookie) 
{

    // The function simply checks to see if the cookie is set.
    // If so, the expiration date is set to Jan. 1st 1970.

    if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
} 
 

function getBrowserDetails()
{
   
    //alert('in');
    var hasReqestedResolution = false;
    if(!(screen.width < 1024 && screen.height < 768))
        hasReqestedResolution = true;
    res = "&res="+screen.width+"x"+screen.height+"&d="+screen.colorDepth 
   
            
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);  

    var versionStr = GetSwfVer();      
     

    expiredays = 100;
        
    // Three variables are used to set the new cookie. 
    // The name of the cookie, the value to be stored,
    // and finally the number of days until the cookie expires.
    // The first lines in the function convert 
    // the number of days to a valid date.

    var ExpireDate = new Date ();
    ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

    // The next line stores the cookie, simply by assigning 
    // the values to the "document.cookie" object.
    // Note the date is converted to Greenwich Mean time using
    // the "toGMTstring()" function.

    document.cookie = 'PushSiteLandCookie' + "=" + escape('PushSiteLandValue') + 
    ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());    


    if(!hasReqestedVersion && !hasReqestedResolution)
        document.location.href  ="/SiteRequirements.aspx?action=set"+res+"&Flash=" +hasReqestedVersion+"&FlashVersion=" +versionStr;          
   
}

