﻿var fBrw = (navigator.userAgent.indexOf('MSIE') != -1 && navigator.userAgent.indexOf('Windows') != -1);
var RefVal2 = new Array();

if (typeof (PageHost) == 'undefined') var PageHost = '';

function getCookie(Name, Default) {
    var cookie = document.cookie;
    var ir = 0, ie = 0, sf = '', i = 0, j = 0;
    Name = Name.toLowerCase();
    if (typeof (Default) == 'undefined')
        Default = '';
    if (cookie.length == 0)
        return Default;
    if ((ir = Name.indexOf('.')) == -1) {
        if (cookie.substr(0, Name.length + 1).toLowerCase() == Name.concat('=')) {
            if ((ie = cookie.indexOf(';')) != -1) {
                cookie = cookie.substr(0, ie);
            }
        }
        else {
            if ((ie = cookie.toLowerCase().indexOf('; '.concat(Name).concat('='))) == -1)
                return Default;
            cookie = cookie.substr(ie + 2);
            if ((ie = cookie.indexOf(';')) != -1) {
                cookie = cookie.substr(0, ie);
            }
        }
        sf = ';';
    }
    else {
        if ((i = cookie.toLowerCase().indexOf(Name.concat('='))) != -1) {
            if ((j = cookie.indexOf(';', i)) > i + Name.length + 1) {
                return ReplaceAll(unescape(cookie.substr(i + Name.length + 1, j - i - Name.length - 1)), '+', ' ');
            }
            else {
                j = cookie.length;
                return ReplaceAll(unescape(cookie.substr(i + Name.length + 1, j - i - Name.length - 1)), '+', ' ');
            }
        }

        var Root = Name.substr(0, ir);
        Name = Name.substr(ir + 1);
        if (cookie.substr(0, Root.length + 1).toLowerCase() == Root.concat('=')) {
            if ((ie = cookie.indexOf(';')) != -1) {
                cookie = cookie.substr(0, ie);
            }
        }
        else {
            if ((ie = cookie.toLowerCase().indexOf('; '.concat(Root).concat('='))) == -1)
                return Default;

            cookie = cookie.substr(ie + 2);

            if ((ie = cookie.indexOf(';')) != -1) {
                cookie = cookie.substr(0, ie);
            }
        }
        cookie = cookie.substr(Root.length + 1);
        sf = '&';
    }

    if (cookie.substr(0, Name.length + 1).toLowerCase() == Name.concat('=')) {
        ir = Name.length + 1;
    }
    else {
        if ((ir = cookie.toLowerCase().indexOf('&'.concat(Name).concat('='))) == -1)
            return Default;
        ir += Name.length + 2;
    }
    if ((ie = cookie.indexOf(sf, ir)) == -1) {
        return ReplaceAll(unescape(cookie.substr(ir)), '+', ' ');
    }
    else {
        return ReplaceAll(unescape(cookie.substring(ir, ie)), '+', ' ');
    }
}
//================================
function checkCookie() {
    if (!(getCookie1('fl') != null && getCookie1('fl') != "")) {
        setCookie1('fl', 0, 365);
    }

    fl = parseInt(getCookie1('fl')) + 1;
    if (fl != null && fl != "") {
        //alert(fl);
        setCookie1('fl', fl, 365);
    }
}
function getCookie1(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 setCookie1(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 ShowFlashObject(objName, objFileName, objWidth, objHeight) {
    var sHTML = '';
    sHTML = sHTML.concat('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH="').concat(objWidth).concat('" HEIGHT="').concat(objHeight).concat('" ID="').concat(objName).concat('" >');
    sHTML = sHTML.concat('	<PARAM NAME="movie" VALUE="').concat('/Images/').concat(objFileName).concat('">');
    sHTML = sHTML.concat('	<PARAM NAME="AllowScriptAccess" VALUE="always">');
    sHTML = sHTML.concat('	<PARAM NAME="quality" VALUE="high">');
    sHTML = sHTML.concat('	<PARAM NAME="bgcolor" VALUE="#FFFFFF">');
    sHTML = sHTML.concat('	<PARAM NAME="wmode" VALUE="transparent">');
    sHTML = sHTML.concat('	<EMBED src="').concat('/Images/').concat(objFileName).concat('" quality="high" bgcolor="#FFFFFF" WIDTH="').concat(objWidth).concat('" HEIGHT="').concat(objHeight).concat('" NAME="').concat(objName).concat('" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" wmode="transparent" AllowScriptAccess="always" >');
    sHTML = sHTML.concat('</OBJECT>');
    return sHTML;
}

/*-----------------Banner---------------------------*/
function ShowTopBanner() {
    if (RefVal1.length > 0) {
        document.writeln('<div>');
        var alTopBanner = new adlistshow(RefVal1, 'TopBanner', 0, 10, 0, 728, 90, true, 1, 30000);
        document.writeln('</div>');
    }
    else {
    /*
        document.writeln('<div style="float:left;width:728;">');
        document.writeln(ShowFlashObject('AdTopBanner', 'lhqc_vne_728x90.swf', 728, 90));
        document.writeln('</div>');
        return;
    */
    }
}

function ShowHalfBaner(vType) {
    if (typeof (vType) == 'undefined') vType = 2;
    if (vType == 2) {
        if (RefVal2.length > 0) {
            document.writeln('<div class="halfbanner fl">');
            var alHalfBanner2 = new adlistshow(RefVal2, 'HalfBanner2', 0, 10, 0, 772, 111, true, 0, 30000);
            document.writeln('</div>');
        }
        else {
            /*
            document.writeln('<div class="halfbanner fl">'); //fl float left Minh?		
            document.writeln(ShowFlashObject('AdHalfBaner1', 'banner_2.swf', 800, 116));
            document.writeln('</div>');
            */
            return;
        }
        /*
        else if (vType==3){
        if (RefVal3.length>0)
        {
        document.writeln('<div class="halfbanner fr">'); //fr float right Minh?
        var alHalfBanner3 = new adlistshow(RefVal3,'HalfBanner3',0,10,0,364,90,true,1,30000);
        document.writeln('</div>');
        }
        else
        {					
        document.writeln('<div class="halfbanner fr">');		
        document.writeln(ShowFlashObject('AdHalfBaner2', 'lhqc_vne_364x90.swf', 364, 90));
        document.writeln('</div>');	
        return;
        }
        }
        */
    }
}
/*-----------------/Banner---------------------------*/


