/* SVN FILE: $Id: 24h.js 417 2009-09-27 08:09:02Z hoangnv $ */
/**
*
* @author $Author: hoangnv $
* @version $Revision: 417 $
* @lastrevision $Date: 2009-09-27 15:09:02 +0700 (Sun, 27 Sep 2009) $
* @modifiedby $LastChangedBy: hoangnv $
* @lastmodified $LastChangedDate: 2009-09-27 15:09:02 +0700 (Sun, 27 Sep 2009) $
* @filesource $URL: http://192.168.1.10/svn_jobs/website/jobs/js/24h.js $
*/
<!--
function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
function fw24h_getFlash( object) {
	var str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" border="0" height="'+object.height+'" width="'+object.width+'"><param name="movie" value="'+object.bannerPath+'"><param name="AllowScriptAccess" value="always"><param name="quality" value="High"><param name="wmode" value="transparent"><embed src="'+object.bannerPath+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" height="'+object.height+'" width="'+object.width+'"></object>';
	return str;
}


function fw24h_isEmail( str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
    

    // check if '@' is at the first position or at last position or absent in given email 
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 ||
		str.indexOf(at)==lstr){
		//alert("Invalid E-mail ID")
		return false
	}

	// check if '.' is at the first position or at last position or absent in given email
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 ||
		str.indexOf(dot)==lstr){
		//alert("Invalid E-mail ID")
		return false
	}

	// check if '@' is used more than one times in given email
	if (str.indexOf(at,(lat+1))!=-1){
		//alert("Invalid E-mail ID")
		return false
	}
   

	// check for the position of '.'
	if (str.substring(lat-1,lat)==dot || 
		str.substring(lat+1,lat+2)==dot){
		//alert("Invalid E-mail ID")
		return false
	}

	// check if '.' is present after two characters   from location of '@'
	if (str.indexOf(dot,(lat+2))==-1){
		//alert("Invalid E-mail ID")
		return false
	}
		
	// check for blank spaces in given email
	if (str.indexOf(" ")!=-1){
		//alert("Invalid E-mail ID")
		return false
	}
	return true					
}

function fw24h_isEmpty( obj){
	if(obj.length == 0){
		return true;
	}
	
	return false;
}
	
function fw24h_isDate( p_date, p_type) {
	
	var p_type = ( p_type == null) ? "VN" : String( p_type).toUpperCase();

	var p_date = String( p_date).toString();

	var tomatch = new RegExp( "^([0-9]{2})-([0-9]{2})-([0-9]{4})$");

	var f_result = tomatch.exec( p_date);
	
	if( f_result == null) {
		return false;
	}

	if ( p_type == 'VN') {
		var p_type_index1 = 1;
		var p_type_index2 = 2;
	}else if(  p_type == 'EN') {
		var p_type_index1 = 2;
		var p_type_index2 = 1;
	}
	
	var f_date = new Date( f_result[3], f_result[p_type_index2]-1, f_result[p_type_index1]);

	if ( parseInt( f_result[3]) == parseInt( f_date.getFullYear()) && parseInt( f_result[p_type_index2]) == parseInt( f_date.getMonth()+1) && parseInt( f_result[p_type_index1]) == parseInt( f_date.getDate()))
	{
		return true;
	}
	
	return false;
}

function fw24h_checkFileExt( filename, ext){
	var ext = ( ext == null) ? ".jpg|.jpeg|.gif" : ext;
	ext = String( ext).replace( /\./gi, "\\.");

	var strEx = new RegExp( "" + ext + "$");
	
	if( strEx.test( filename)) {
		return true;
	}
    
	return false;	
}
	
function fw24h_isURL(url){		 
	 var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/

	 if( tomatch.test( url)){
		 return true;
	 }
	 return false;
}
	
	/*function checkPhone(str){
       // xxx-xx-xxxx
       var regexp = /^(\d{9}|\d{3}-\d{2}-\d{4})$/;
       return regexp.test(str);
    }*/
	
	
function fw24h_isPhoneNumber( s){	
	var rePhoneNumber = new RegExp(/^[+\(\)\. 0-9\,\-]+$/);
	
	if ( !rePhoneNumber.test( s)) {
		return false;
	}
	
	return true;
}
	
function fw24h_isUsername( strUsername, p_allow_chars, p_min, p_max) {
	
	var p_allow_chars = ( p_allow_chars == null) ? "" : p_allow_chars;
    var p_min = ( p_min == null) ? 4 : p_min;
    var p_max = ( p_max == null) ? 14 : p_max;

	var f_len = strUsername.length;
	
	if( f_len < p_min || f_len > p_max) {
		return false;
	}

	var strEx = new RegExp( "^[a-zA-Z0-9" + p_allow_chars + "]+$");

	if( !strEx.test( strUsername)) {
		return false;
	}
	
	return true;
}


// cac ham lien quan den Banner chia se & banner luan phien ngau nhien
/////////////////////////////////
// File Name: mBanner.js      //
// By: Manish Kumar Namdeo    //
/////////////////////////////////

// BANNER OBJECT
function Banner(objName){
        this.obj = objName;
        this.aNodes = [];
        this.bNodes = [];
        this.currentBanner = 0;//Math.floor(Math.random()*3);
		this.intLoopCount = 1;
		this.intBannerFix = -1;
		this.intBannerLong = 0;
};

// ADD NEW BANNER
Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
        this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};
// Add2
Banner.prototype.add2 = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink, position) {
        this.bNodes[this.bNodes.length] = new Node(this.obj +"_"+ this.bNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink, position);
};

// Node object
function Node(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
        this.name = name;
        this.bannerType = bannerType;
        this.bannerPath = bannerPath;
        this.bannerDuration = bannerDuration;
        this.height = height
        this.width = width;
        this.hyperlink= hyperlink;
};

function Node2(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink, position) {
        this.name = name;
        this.bannerType = bannerType;
        this.bannerPath = bannerPath;
        this.bannerDuration = bannerDuration;
        this.height = height
        this.width = width;
        this.hyperlink= hyperlink;
        this.position= position;
};

// Outputs the banner to the page
Banner.prototype.toString = function() {
		this.currentBanner = Math.floor(Math.random()*this.aNodes.length); // lay ngau nhien 1 banner
        var str = ""
		for (var iCtr=0; iCtr < this.aNodes.length; iCtr++) {
				str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                str = str + 'class="m_banner_hide" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
					str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }

				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
        }
		document.write( str);
		str = '';
        return str;
};

// START THE BANNER ROTATION
Banner.prototype.start = function(){
	if (this.aNodes.length==0)
	{
		return true;
	}
	this.changeBanner();
	var thisBannerObj = this.obj;
	// CURRENT BANNER IS ALREADY INCREMENTED IN cahngeBanner() FUNCTION
	setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].bannerDuration * 1000);
}

// CHANGE BANNER
Banner.prototype.changeBanner = function(){
		//
    try {
		
		if( this.intLoopCount > (this.aNodes.length*3 + 1)) {
			this.intBannerLong++;
			if( this.intBannerLong%3 != 0) {
				return false;
			}
		}
		
		var thisBanner;
		var prevBanner = -1;
		if (this.currentBanner>this.aNodes.length-1)
		{
			this.currentBanner=0;
		}
		if (this.currentBanner < this.aNodes.length ){
			thisBanner = this.currentBanner;
			if (this.aNodes.length > 1){
				if ( thisBanner > 0 ){
					prevBanner = thisBanner - 1;
				}else{
					prevBanner = this.aNodes.length-1;
				}
			}
			if (this.currentBanner < this.aNodes.length - 1){
				this.currentBanner = this.currentBanner + 1;
			}else{
				this.currentBanner = 0;
			}
		}
		

		if (prevBanner >= 0){
			document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide";
		}
		document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show";
		this.intLoopCount++;
		
	} catch(e) {}
}


// d_Banner2
// Written by ThaoDX
function d_Banner2(objName){
        this.obj = objName;
        this.aNodes = [];
        this.bNodes = [];
        this.currentBanner = 0;
       
};
// ADD NEW BANNER
d_Banner2.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) {
		var bannerDuration = 0;
        this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};
// add2
d_Banner2.prototype.add2 = function(bannerType, bannerPath, height, width, hyperlink, position) {
		var bannerDuration = 0;
        this.bNodes[this.bNodes.length] = new Node2(this.obj +"_"+ this.bNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink, position);
};
// Outputs the banner to the page
d_Banner2.prototype.toString = function() {
        var str = "";
		var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length;
		var i = 1;
		for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++){
                // iB for loop
				//str += "I: " + i + "<HR>";
				for(var iB=0; iB < this.bNodes.length; iB++){
					if(i == this.bNodes[iB].position){
						str = str + '<span name="'+this.bNodes[iB].name+'" '
						str = str + 'id="'+this.bNodes[iB].name+'" ';
						str = str + 'class="d_banner2_show" ';
						str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
						str = str + 'align="center" ';
						str = str + 'valign="top" >\n';
						if (this.bNodes[iB].hyperlink != ""){
								str = str + '<a href="'+this.bNodes[iB].hyperlink+'" target="_blank">';
						}
							   
						if ( this.bNodes[iB].bannerType == "FLASH" ){
							str  += fw24h_getFlash( this.bNodes[iB]);
						}else if ( this.bNodes[iB].bannerType == "IMAGE" ){
								str = str + '<img src="'+this.bNodes[iB].bannerPath+'" ';
								str = str + 'border="0" ';
								str = str + 'height="'+this.bNodes[iB].height+'" ';
								str = str + 'width="'+this.bNodes[iB].width+'">';
						}
						if( this.bNodes[iB].bannerType == "TEXT") {
							str = str + '<iframe width="'+this.bNodes[iB].width+'" height="'+this.bNodes[iB].height+'" src="'+this.bNodes[iB].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
						}
		
						if (this.bNodes[iB].hyperlink != ""){
								str = str + '</a>';
						}
		
						str += '</span>';
						// str = str + 'Thao Pro '+i;
						i++; continue;
					}
				}
				// End iB for loop
				str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                str = str + 'class="d_banner2_show" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
                        str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
				i++;
        }
		//BannerPostion = 0;
		//return str;
		//str += "<HR>a " + BannerPostion + "  a <HR>";;
		for (var iCtr=0; iCtr < BannerPostion; iCtr++){
                // iB for loop
				for(var iB=0; iB < this.bNodes.length; iB++){
					if(i == this.bNodes[iB].position){
						str = str + '<span name="'+this.bNodes[iB].name+'" '
						str = str + 'id="'+this.bNodes[iB].name+'" ';
						str = str + 'class="d_banner2_show" ';
						str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
						str = str + 'align="center" ';
						str = str + 'valign="top" >\n';
						if (this.bNodes[iB].hyperlink != ""){
								str = str + '<a href="'+this.bNodes[iB].hyperlink+'" target="_blank">';
						}
							   
						if ( this.bNodes[iB].bannerType == "FLASH" ){
								str  += fw24h_getFlash( this.bNodes[iB]);
						}else if ( this.bNodes[iB].bannerType == "IMAGE" ){
								str = str + '<img src="'+this.bNodes[iB].bannerPath+'" ';
								str = str + 'border="0" ';
								str = str + 'height="'+this.bNodes[iB].height+'" ';
								str = str + 'width="'+this.bNodes[iB].width+'">';
						}
						if( this.bNodes[iB].bannerType == "TEXT") {
							str = str + '<iframe width="'+this.bNodes[iB].width+'" height="'+this.bNodes[iB].height+'" src="'+this.bNodes[iB].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
						}
		
						if (this.bNodes[iB].hyperlink != ""){
								str = str + '</a>';
						}
		
						str += '</span>';
						i++; continue;
					}
					else{
						//str = str + 'i: e '+i;	
					}
				}
				// End iB for loop
                str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                //str = str + 'class="m_banner_hide" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'class="d_banner2_show" ';
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
                        str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }
                str += '</span>';
				i++;
        }
		for(x = 0; x < this.bNodes.length; x++) {
			
			if(this.bNodes[x].position >= i) {
				str = str + '<span name="'+this.bNodes[x].name+'" '
				str = str + 'id="'+this.bNodes[x].name+'" ';
				str = str + 'class="d_banner2_show" ';
				str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
				str = str + 'align="center" ';
				str = str + 'valign="top" >\n';
				if (this.bNodes[x].hyperlink != ""){
					str = str + '<a href="'+this.bNodes[x].hyperlink+'" target="_blank">';
				}
							   
				if ( this.bNodes[x].bannerType == "FLASH" ){
					str  += fw24h_getFlash( this.bNodes[x]);
				}else if ( this.bNodes[x].bannerType == "IMAGE" ){
					str = str + '<img src="'+this.bNodes[x].bannerPath+'" ';
					str = str + 'border="0" ';
					str = str + 'height="'+this.bNodes[x].height+'" ';
					str = str + 'width="'+this.bNodes[x].width+'">';
				}
				if( this.bNodes[x].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.bNodes[x].width+'" height="'+this.bNodes[x].height+'" src="'+this.bNodes[x].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}
		
				if (this.bNodes[x].hyperlink != ""){
					str = str + '</a>';
				}
		
				str += '</span>';	
			}
		}
		document.write( str);
        str = '';
        return str;
};

// d_Banner
// d_Banner
// Written by Dungpt
function d_Banner(objName){
        this.obj = objName;
        this.aNodes = [];
        this.currentBanner = 0;
       
};
// ADD NEW BANNER
d_Banner.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) {
		var bannerDuration = 0;
        this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};
// Outputs the banner to the page
d_Banner.prototype.toString = function() {
        var str = "";
		var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length;
        for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++){
                str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                str = str + 'class="d_banner_show" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
                        str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
        }
		for (var iCtr=0; iCtr < BannerPostion; iCtr++){
                str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                //str = str + 'class="m_banner_hide" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'class="d_banner_show" ';
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
                       str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
        }
		document.write( str);
        str = '';
        return str;
};
// Written by Dungpt
function dFloat_Banner(objName){
        this.obj = objName;
        this.aNodes = [];
        this.currentBanner = 0;
       
};
// ADD NEW BANNER
dFloat_Banner.prototype.add = function(bannerType, bannerPath, height, width, hyperlink) {
		var bannerDuration = 0;
        this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};
// Outputs the banner to the page
dFloat_Banner.prototype.toString = function() {
        var str = "";
		var BannerPostion = Math.floor(Math.random()*12321) % this.aNodes.length;
        for (var iCtr=BannerPostion; iCtr < this.aNodes.length; iCtr++){
                str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                //str = str + 'class="m_banner_hide" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'class="d_Banner2_show" ';
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
					str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
        }
		for (var iCtr=0; iCtr < BannerPostion; iCtr++){
                str = str + '<span name="'+this.aNodes[iCtr].name+'" '
                str = str + 'id="'+this.aNodes[iCtr].name+'" ';
                //str = str + 'class="m_banner_hide" ';
                str = str + 'bgcolor="#FFFCDA" ';        // CHANGE BANNER COLOR HERE
                str = str + 'align="center" ';
                str = str + 'valign="top" >\n';
                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" target="_blank">';
                }
                       
                if ( this.aNodes[iCtr].bannerType == "FLASH" ){
					str  += fw24h_getFlash( this.aNodes[iCtr]);
                }else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
                        str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
                        str = str + 'border="0" ';
                        str = str + 'height="'+this.aNodes[iCtr].height+'" ';
                        str = str + 'width="'+this.aNodes[iCtr].width+'">';
                }
				if( this.aNodes[iCtr].bannerType == "TEXT") {
					str = str + '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>'
				}

                if (this.aNodes[iCtr].hyperlink != ""){
                        str = str + '</a>';
                }

                str += '</span>';
        }
        return str;
};

function flashWrite(url,w,h,id,bg,vars){

     var flashStr=
    "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
    "<param name='allowScriptAccess' value='always' />"+
    "<param name='movie' value='"+url+"' />"+
    "<param name='FlashVars' value='"+vars+"' />"+
    "<param name='wmode' value='transparent' />"+
    "<param name='menu' value='false' />"+
    "<param name='quality' value='high' />"+
    "<embed src='"+url+"' FlashVars='"+vars+"' wmode='transparent' menu='false' quality='high' width='"+w+"' height='"+h+"' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
    "</object>";
    document.write( flashStr);
}


// misc funcs
// @author: DungPT@24H.COM.VN
function CreateBookmarkLink() {
	title = "EVA - The gioi phai dep Viet Nam"; 
	url = "http://www.eva.vn";

	if( window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel( title, url, "");
	}else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); 
	} else if( window.opera && window.print) { // Opera Hotlist
		return true; 
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

/**
/* @author: DungPT@24H.COM.VN
/* @date: 9/10/2008
/* 
/* Write part of a string
/* Write the portion of string specified by the len parameters.
*/

function j_substr( str, len) {
	
	if( str.length<=len) {
		document.write( str);
		return true;
	}
	var str2 = str.substring( 0, str.substring( 0, len).lastIndexOf( " "));
	document.write( str2 + '...');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}


/*
Script Name: Javascript Cookie Script
Author: Public Domain, with some modifications
Script Source URI: http://techpatterns.com/downloads/javascript_cookies.php
Version 1.1.1
Last Update: 4 October 2007
*/
// Set_Cookie( 'mycookie', 'visited 9 times', 30, '/', '', '' );.

function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	
	var expires_date = new Date( today.getTime() + (expires));

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}


// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );

		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

// this deletes the cookie when called
// Delete_Cookie('cookie name', '/', '')
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name)) {
		document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}


function GetXmlHttpObject(){
	var objXMLHttp = null;
	if( window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	}else if( window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

function AjaxAction( where, url){
	var xmlHttp = new GetXmlHttpObject()
	if(xmlHttp==null){
		return;
	}
	var bar = '<center><img src="http://localhost:8043/jobs/images/load.gif" align="absmiddle" /> &#272;ang t&#7843;i d&#7919; li&#7879;u</center>';
	document.getElementById( where).innerHTML = bar;
	

	xmlHttp.onreadystatechange= function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
			document.getElementById( where).innerHTML = xmlHttp.responseText
		}
	}
	
	xmlHttp.open( "GET", url, true);
	
	// Set header so the called script knows that it's an XMLHttpRequest
	xmlHttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
	
	xmlHttp.send(null);
}

function fw24h_openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
function $(id) {
	return document.getElementById(id);
}

function showCode(what) {
	var codeBox = $(what);
	codeBox.style.display = 'block';		
	return false;
}

function hideCode() {
	var codeBox = $('codeBox');
	codeBox.style.display = 'none';
	return false;
}
function hideBox(box) {
	var codeBox = $(box);
	codeBox.style.display = 'none';
	return false;
}