﻿// AI Util Func
var AIclient = window.navigator.userAgent.toLowerCase(); // Get client info
var clientInfo = {
    isMSIE  : (AIclient.indexOf('msie')!=-1),
    
    isMSIE7  : (AIclient.indexOf('msie 7.')!=-1),
    
    isGecko : ((AIclient.indexOf('gecko')!=-1) && 
                (AIclient.indexOf('spoofer')==-1)&& 
                (AIclient.indexOf('khtml')==-1) && 
                (AIclient.indexOf('netscape')==-1)),
                
    isSafari:    ((AIclient.indexOf('AppleWebKit')!=-1) && 
                (AIclient.indexOf('spoofer')==-1)),
                
    isKhtml : (window.navigator.vendor == 'KDE' || 
                ( document.childNodes && !document.all && !window.navigator.taintEnabled )),
                
    isOpera : (AIclient.indexOf('opera')!=-1),
    
    isOpera7: ((AIclient.indexOf('opera')!=-1) && 
                (window.opera && document.childNodes))
};

var clientScreen = {
    width: (window.screen.width),
    height: (window.screen.height),
    resolution : (window.screen.width.toString() + 'x' + window.screen.height.toString()),
    color : (window.screen.colorDepth)
};

function checkClient(){
    var msg = "Client Browser \r\n";
    if (clientInfo.isMSIE7)
        msg += "Internet Explprer 7 \r\n";
    else if (clientInfo.isMSIE)
        msg += "Internet Explprer \r\n";
    else if (clientInfo.isGecko)
        msg += "Gecko \r\n";
    else if (clientInfo.isSafari)
        msg += "Safari \r\n";
    else if (clientInfo.isOpera7)
        msg += "Opera 7 \r\n";
    else if (clientInfo.isOpera)
        msg += "Opera \r\n";
        
    msg += 'x :'+clientScreen.width+' y:'+clientScreen.height + '\r\n';
    msg +=  clientScreen.resolution+' colors:'+clientScreen.color  + '\r\n';
    if(clientScreen.width < 1024 || clientScreen.height < 768){
        msg = 'For a best experience on this site \r\n please use Internet Explorer, Firefox 2 or Safari 3 \r\n with screen resolution 1024 X 768';
        alert (msg);
    }
}
checkClient();
