function adlistshow(AdList, AdName, CheckShow, ShowType, Interface, LimitWidth, LimitHeight, Extra){
	this.myid=AdName;
	this.checkshow=CheckShow;
	this.limitwidth=LimitWidth;
	this.limitheight=LimitHeight;
	this.showtype=ShowType;
	this.face=Interface;
	this.delay=15000;
	this.rotator=true;
	if (typeof(Extra) == 'undefined') {this.extra='';} else {this.extra=Extra;}
	switch (ShowType) {
		case 0:	case 4:	case 5: case 6: this.readtype=0; break;
		case 8: this.readtype=2; break;
		case 9: this.readtype=3; this.rotator=false; break;
		default: this.readtype=1; break;
	}
	var arTemp = new Array();
	var i, j, k, no, showcount;
	i=0;j=-1;k=0;no=-1;showcount=1;
	if (this.readtype==0){
		for (i=0,j=0;i<AdList.length;i++){
			if (this.checkShowThis(AdList[i])){
				arTemp[j]=AdList[i];
				j++;
			}
		}
	}
	else if (this.readtype==1){
		for (i=0;i<AdList.length;i++){
			if (AdList[i][5]!=no){
				no=AdList[i][5];
				if (showcount>0) j++;
				showcount=0;
				k=0;
			}
			if (this.checkShowThis(AdList[i])){
				if (k==0) arTemp[j] = new Array();
				arTemp[j][k] = AdList[i];
				showcount++;
				k++;
			}
		}
	}
	else if (this.readtype==2){
		for (i=0,j=0;i<AdList.length;i++){
			if (this.checkShowThis(AdList[i])){
				arTemp[j] = new Array();
				arTemp[j][0] = new Array();
				arTemp[j][0][0] = AdList[i][0];
				arTemp[j][0][1] = AdList[i][2];
				arTemp[j][0][2] = AdList[i][3];
				arTemp[j][0][3] = AdList[i][4];
				arTemp[j][0][4] = AdList[i][5];
				arTemp[j][1] = new Array();
				arTemp[j][1][0] = AdList[i][1];
				arTemp[j][1][1] = AdList[i][2];
				arTemp[j][1][2] = AdList[i][3];
				arTemp[j][1][3] = AdList[i][6];
				arTemp[j][1][4] = AdList[i][7];
				j++;
			}
		}
	}
	else if (this.readtype==3){
		for (i=0;i<AdList.length;i++){
			if (this.checkShowThis(AdList[i]) && AdList[i][5]<100){
				j++;
				arTemp[j] = new Array();
				arTemp[j][0] = AdList[i];
			}
		}
		AdList.sort(randOrd);
		//j++;
		//k=0;
		k=1000;
		for (i=0;i<AdList.length;i++){
			if (this.checkShowThis(AdList[i]) && AdList[i][5]>=100){
				if (k>1 || (RelatedFolder==1 && AdList.length<=10) || (RelatedFolder!=1 && AdList.length<=6)) {
					j++;
					k=0;
				}
				if (k==0) arTemp[j] = new Array();
				arTemp[j][k] = AdList[i];
				k++;
			}
		}
		arTemp.sort(randOrd);
	}
	this.itemcount=j+1;
	this.listvalue=arTemp;
	this.initialize();
}

adlistshow.prototype.initialize=function(){
	switch (this.showtype) {
		case 0: this.displayrotatorbanner(); break;
		case 1: case 7: this.displaylistbanner(); break;
		case 2: this.displayfloatbanner(0); break;
		case 3: this.displayfloatbanner(1); break;
		case 4: this.displayfloatbanner(2); break;
		case 5: this.displaypopupbanner(false); break;
		case 6: this.displaypopupbanner(true); break;
		case 8: this.displayexpandbanner(); break;
		case 9: this.displaylistspecialbanner(); break;
		default: break;
	}
}

adlistshow.prototype.checkLastObj=function(index){
	if (this.readtype==0){
		return true;
	}
	else {
		if (this.listvalue.length==index+1){
			return true;
		}
		else {
			return false;
		}
	}
}

adlistshow.prototype.displayrotatorbanner=function(){
	document.write('<table ', (this.limitwidth>0)?'width='.concat(this.limitwidth):'', ' cellspacing=0 cellpadding=0 border=0>');
	this.writerotatorbanner(this.listvalue,0);
	document.write('</table>');
}

adlistshow.prototype.displaylistbanner=function(){
	if (this.face==0){
		document.write('<table ', (this.limitwidth>0)?'width='.concat(this.limitwidth):'', ' cellspacing=0 cellpadding=0 border=0 align=center>');
	}
	for (var i=0;i<this.listvalue.length;i++){
		if (this.listvalue[i][0][5]<100){
			this.writerotatorbanner(this.listvalue[i],i,this.checkLastObj(i));
		}
		else {
			this.writerandombanner(this.listvalue[i],this.checkLastObj(i));
		}
	}
	if (this.face==0){
		document.write('</table>');
	}
}

adlistshow.prototype.displaylistspecialbanner=function(){
	if (this.face==0){
		document.write('<table ', (this.limitwidth>0)?'width='.concat(this.limitwidth):'', ' cellspacing=0 cellpadding=0 border=0 align=center>');
	}
	for (var i=0;i<this.listvalue.length;i++){
		this.writerotatorbanner(this.listvalue[i],i,this.checkLastObj(i));
	}
	if (this.face==0){
		document.write('</table>');
	}
}

adlistshow.prototype.displayfloatbanner=function(type){
	if (type==2){
		document.write('<DIV id="floatdiv',this.myid,'" style="position:absolute;overflow:hidden;top:0;left:-200;',(this.limitheight>0)?'height:'.concat(this.limitheight):'180',';',(this.limitwidth>0)?'width:'.concat(this.limitwidth):'115',';">');
		this.writebottomupbanner(this.listvalue);
	}
	else{
		document.write('<DIV id="floatdiv',this.myid,'" style="position:absolute;top:0;left:-200;',(this.limitwidth>0)?'width:'.concat(this.limitwidth):'115',';">');
		this.displaylistbanner();
	}
	document.write('</DIV>');
	if (this.listvalue.length>0) {
		FloatTopDiv('floatdiv'.concat(this.myid),type);
	}
}

adlistshow.prototype.displaypopupbanner=function(type){
	vIndex = this.listvalue[0][2].lastIndexOf(',');
	vID = this.listvalue[0][2].substr(vIndex + 2);
	sLink = buildLink(vID,this.listvalue[0][1]);
	var arrPara = this.listvalue[0][2].split(",");	
	openPopup(this.listvalue[0][0], sLink, 'Advertisment', arrPara[2], arrPara[9], arrPara[8], screen.height - arrPara[9] - 80, (screen.width - 770)/2 + 410 - 5, type);
}

adlistshow.prototype.displayexpandbanner=function(){
	document.write('<table align=center ', (this.limitwidth>0)?'width='.concat(this.limitwidth):'', ' cellspacing=0 cellpadding=0 border=0>');
	this.writeexpandbanner(this.listvalue,0);
	document.write('</table>');
}

adlistshow.prototype.writerotatorbanner=function(obj,index,lastobj){
	obj.sort(randOrd);
	if (this.face==1) {
		document.write('<tr><td id="', this.myid, '_', index, '" style="padding:4px;">');
	}
	else {
		document.write('<tr><td id="', this.myid, '_', index, '">');
	}
	document.write(buildhtml(obj[0],this.limitwidth,this.limitheight));
	if (obj.length>1){
		var idtemp = ''.concat(this.myid).concat('_').concat(index);
		var delaytime = this.delay + Math.round(Math.random()*10000);
		var limitwidth = this.limitwidth;
		var limitheight = this.limitheight;
		if (this.rotator) setTimeout(function(){changebanner(obj,0,idtemp,delaytime,limitwidth,limitheight)}, delaytime);
	}
	document.write('</td></tr>');
	if (this.face==0){
		document.write('<tr><td height="3"></td></tr>');
	}
	if (this.face==1 && (!lastobj)) {
		document.write('<tr><td height="1" bgcolor="#808080"></td></tr>');
	}
}

adlistshow.prototype.writerandombanner=function(obj,lastobj){
	obj.sort(randOrd);
	for (var i=0;i<obj.length;i++){
		if (this.face==1) {
			document.write('<tr><td style="padding:4px;">');
		}
		else{
			document.write('<tr><td>');
		}
		document.write(buildhtml(obj[i],this.limitwidth,this.limitheight));
		document.write('</td></tr>');
		if (this.face==0){
			document.write('<tr><td height="3"></td></tr>');
		}
		if (this.face==1 && (i<obj.length-1)) {
			document.write('<tr><td height="1" bgcolor="#808080"></td></tr>');
		}
	}
}

adlistshow.prototype.writebottomupbanner=function(obj){
	obj.sort(randOrd);
	document.write('<DIV id="subdiv',this.myid,'" style="position:absolute;',(this.limitheight>0)?'top:'.concat(this.limitheight):'180',';',(this.limitwidth>0)?'width:'.concat(this.limitwidth):'115',';',(this.limitheight>0)?'height:'.concat(this.limitheight):'180',';">');
	document.write(buildhtml(obj[0],this.limitwidth,this.limitheight));
	var idtemp = 'subdiv'.concat(this.myid);
	var delaytime = this.delay + Math.round(Math.random()*10000);
	var limitwidth = this.limitwidth;
	var limitheight = this.limitheight;
	var delaytime=this.delay + Math.round(Math.random()*10000);
	setTimeout(function(){startbottomupbanner(obj,0,idtemp,delaytime,limitwidth,limitheight)}, 500);
	document.write('</DIV>');
}

adlistshow.prototype.writeexpandbanner=function(obj){
	if (obj.length<=0) return;
	var limitwidth = this.limitwidth;
	var limitheight = this.limitheight;
	var idtemp = ''.concat(this.myid);
	var delaytime = this.delay + Math.round(Math.random()*10000);
	obj.sort(randOrd);
	document.write('<tr><td>');
	document.write('<DIV id="', idtemp, '" style="position:related;overflow:hidden;width:'.concat(obj[0][0][3]),';height:'.concat(obj[0][0][4]),';">');
	document.write(buildhtml(obj[0][0],this.limitwidth,this.limitheight));
	if (obj.length>1){
		//setTimeout(function(){changebanner(obj,0,idtemp,delaytime,limitwidth,limitheight)}, delaytime);
	}
	document.write('</DIV></td></tr>');
	document.write('<tr><td align=center id="', idtemp, '_extend"><font face="Arial" size="1"><b>');
	document.write('<span id="', idtemp, '_expandcollap" style="cursor:pointer;">M&#7903; r&#7897;ng</span>&nbsp;-&nbsp;');
	document.write('<span id="', idtemp, '_close" style="cursor:pointer;">&#272;&#243;ng</span>');
	document.write('<input type="hidden" id="', this.myid, '_hidden">');
	document.write('</td></tr>');
	document.getElementById(idtemp + '_hidden').value = 0;
	document.getElementById(idtemp).onmouseover = function(){expandbanner(obj,idtemp,limitwidth,limitheight)};
	document.getElementById(idtemp + '_expandcollap').onclick = function(){expandbanner(obj,idtemp,limitwidth,limitheight)};
	document.getElementById(idtemp + '_close').onclick = function(){closebanner(idtemp)};
}

function expandbanner(obj,bannerid,limitwidth,limitheight){
	var index = document.getElementById(bannerid + '_hidden').value;
	if (parseInt(document.getElementById(bannerid).offsetHeight) < obj[index][1][4]){
		document.getElementById(bannerid).style.height = parseInt(document.getElementById(bannerid).offsetHeight) + 5;
		setTimeout(function(){expandbanner(obj,bannerid,limitwidth,limitheight)}, 50);
		return;
	}
	document.getElementById(bannerid).onmouseover = 'undefine';
	document.getElementById(bannerid + '_expandcollap').innerHTML = 'Thu nh&#7887;';
	document.getElementById(bannerid + '_expandcollap').onclick = function(){collapbanner(obj,bannerid,limitwidth,limitheight)};
	document.getElementById(bannerid).innerHTML = buildhtml(obj[index][1],limitwidth,limitheight);
}

function collapbanner(obj,bannerid,limitwidth,limitheight){
	var index = document.getElementById(bannerid + '_hidden').value;
	if (parseInt(document.getElementById(bannerid).offsetHeight) > obj[index][0][4]){
		document.getElementById(bannerid).style.height = parseInt(document.getElementById(bannerid).offsetHeight) - 5;
		setTimeout(function(){collapbanner(obj,bannerid,limitwidth,limitheight)}, 50);
		return;
	}
	document.getElementById(bannerid).onmouseover = function(){expandbanner(obj,bannerid,limitwidth,limitheight)};
	document.getElementById(bannerid + '_expandcollap').innerHTML = 'M&#7903; r&#7897;ng';
	document.getElementById(bannerid + '_expandcollap').onclick = function(){expandbanner(obj,bannerid,limitwidth,limitheight)};
	document.getElementById(bannerid).innerHTML = buildhtml(obj[index][0],limitwidth,limitheight);
}

function closebanner(bannerid){
	document.getElementById(bannerid).style.display = 'none';
	document.getElementById(bannerid + '_extend').style.display = 'none';
}

function changebanner(obj,index,bannerid,delaytime,limitwidth,limitheight){
	if (index==obj.length-1) {index=0;} else {index++;}
	document.getElementById(bannerid).innerHTML=buildhtml(obj[index],limitwidth,limitheight);
	setTimeout(function(){changebanner(obj,index,bannerid,delaytime,limitwidth,limitheight)},delaytime);
}

function startbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight){
	var ftlObj = document.getElementById(bannerid)
	if (!ftlObj) return;
	var pY = parseInt(ftlObj.style.top);
	pY = pY - Math.round(parseInt(ftlObj.style.top)/8) - 1;
	if (pY>0){
		ftlObj.style.top = pY;
		setTimeout(function(){startbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight)},10);
	}
	else{
		ftlObj.style.top = 0;
		setTimeout(function(){endbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight)},delaytime);		
	}
}

function endbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight){
	var ftlObj = document.getElementById(bannerid)
	if (!ftlObj) return;
	var pY = parseInt(ftlObj.style.top);
	pY = pY + Math.round((limitheight-parseInt(ftlObj.style.top))/8) + 1;
	if (pY<limitheight){
		ftlObj.style.top = pY;
		setTimeout(function(){endbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight)},10);
	}
	else{
		ftlObj.style.top = limitheight;
		if (index==obj.length-1) {index=0;} else {index++;}
		document.getElementById(bannerid).innerHTML=buildhtml(obj[index],limitwidth,limitheight);
		setTimeout(function(){startbottomupbanner(obj,index,bannerid,delaytime,limitwidth,limitheight)},5000);		
	}
}

function buildhtml(obj,limitwidth,limitheight){
	if (!obj) {return ''}
	var sTemp = '';
	var sImageLink = (Left(obj[0],7).toLowerCase() == 'http://')?obj[0]:PageHost.concat(obj[0]);
	var imagewidth = (limitwidth<obj[3] && limitwidth>0)?limitwidth:obj[3];
	var imageheight = (limitheight<obj[4] && limitheight>0)?limitheight:obj[4];
	if (Right(obj[2],6)==', 3685'){
		return '<iframe id="ab4530d2" name="ab4530d2" src="http://203.146.251.72/max/www/delivery/afr.php?zoneid=2&cb=INSERT_RANDOM_NUMBER_HERE" framespacing="0" frameborder="no" scrolling="no" width="468" height="60"><a href="http://203.146.251.72/max/www/delivery/ck.php?n=a1338f72&amp;cb=INSERT_RANDOM_NUMBER_HERE" target="_blank"><img src="http://203.146.251.72/max/www/delivery/avw.php?zoneid=2&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a1338f72" border="0" alt="" /></a></iframe>';
	}
	if (Right(obj[0],4).toLowerCase() == '.swf'){
		sTemp = sTemp.concat('<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" width=').concat(imagewidth).concat(' height=').concat(imageheight).concat('>');
		sTemp = sTemp.concat('<param name="movie" value="').concat(sImageLink).concat('?link=').concat(escape(buildLink(obj[2].substring(obj[2].lastIndexOf(',')+2),obj[1]))).concat('">');
		sTemp = sTemp.concat('<param name="quality" value="High">');
		//sTemp = sTemp.concat('<param name="wmode" value="transparent">');
		//sTemp = sTemp.concat('<embed src="').concat(sImageLink).concat('?link=').concat(escape(buildLink(obj[2].substring(obj[2].lastIndexOf(',')+2),obj[1]))).concat('" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" value="High" wmode="transparent" width=').concat(imagewidth).concat(' height=').concat(imageheight).concat('>');
		sTemp = sTemp.concat('<embed src="').concat(sImageLink).concat('?link=').concat(escape(buildLink(obj[2].substring(obj[2].lastIndexOf(',')+2),obj[1]))).concat('" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" value="High" width=').concat(imagewidth).concat(' height=').concat(imageheight).concat('>');
		sTemp = sTemp.concat('</object>');
	}
	else{
		if (obj[1] != '') {
			sTemp = '<a href="'.concat(obj[1]).concat('" onClick="return openMeExt(this, ').concat(obj[2]).concat(', 1)"><img src="').concat(sImageLink).concat('" border=0 width=').concat(imagewidth).concat(' height=').concat(imageheight).concat('></a></td>'); 
		}
		else {
			sTemp = '<img src="'.concat(sImageLink).concat('" border=0 width=').concat(imagewidth).concat(' height=').concat(imageheight).concat('></td>');
		}
	}
	return sTemp;
}

adlistshow.prototype.checkShowThis=function(obj){
	var checkShow=false;
	var iCheck;
	if (this.showtype==8){
		iCheck = obj[9];
	}
	else{
		iCheck = obj[6];
	}
	
	if (iCheck == 3 && this.checkshow < 4) checkShow=true;
	else if (iCheck == this.checkshow || iCheck == 0) checkShow=true;
	
	//Truong hop dac biet Son nguyen chi quang cao o muc thue va cho thue nha
	if (RelatedFolder==9998)
		if (obj[1].indexOf('http://www.sonnguyenvn.com')>=0 || obj[1].indexOf('http://www.bds.vn')>=0)
		{
			if (window.location.href.indexOf("c=12")>0 || window.location.href.indexOf("c=14")>0)
				{return true} else {return false}
		}

	if (checkShow && this.showtype==7){
		checkShow=false;
		if (typeof(dtSubjectDate) == 'undefined') return;
		var dtFromDate = new Date(obj[7]);
		var dtToDate = new Date(obj[8]);
		var iFromDiff = (dtSubjectDate.getTime()-dtFromDate.getTime())/1000;
		var iToDiff   = (dtToDate.getTime()-dtSubjectDate.getTime())/1000;
		if (iFromDiff<5*86400 && iFromDiff>=0 && iToDiff>5*86400 && iToDiff>=0){
			checkShow=true;
		}
	}
	return checkShow;
}

//function randOrd(){ return (Math.round(Math.random())-0.5); } 
function randOrd(){ return (Math.random()*10000)-5000; } 

function openPopup(vImage, vLink, vTitle, vScrollbars, vWidth, vHeight, vTop, vLeft, vHide)
{
	if (typeof(vHide) == 'undefined'){
		vHide = false;
	}

	if (vHide){
		var pw = open('/Library/PopupUnder.Asp?vImage='.concat(escape(vImage)).concat('&vLink=').concat(escape(vLink)).concat('&vTitle=').concat(escape(vTitle)), 'Popup_'.concat(ReplaceAll(vTitle, ' ', '_')), 'status=no,resizable=no,scrollbars='.concat(vScrollbars).concat(',toolbar=no,location=no,fullscreen=no,titlebar=no,height=').concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',').concat('top=').concat(0).concat(',').concat('left=').concat(0));
		var LinkStr = vLink;
		window.focus();
		return pw;
	}
	else{
		return open('/Library/Popup.Asp?vImage='.concat(escape(vImage)).concat('&vLink=').concat(escape(vLink)).concat('&vTitle=').concat(escape(vTitle)), 'Popup_'.concat(ReplaceAll(vTitle, ' ', '_')), 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',').concat('top=').concat(vTop).concat(',').concat('left=').concat(vLeft));
	}
}

function openMeExt(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vHeight, vWidth, vTop, vLeft, vID, vCounter)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	winDef = '';
	winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('height=').concat(vHeight-140).concat(',');
	winDef = winDef.concat('width=').concat(vWidth).concat(',');

	if (vCentered){
		winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
		winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	}
	else{
		winDef = winDef.concat('top=').concat(vTop).concat(',');
		winDef = winDef.concat('left=').concat(vLeft);
	}

	if (typeof(vCounter) == 'undefined'){
		vCounter = 0;
	}

	if (typeof(vID) == 'undefined')	{
		vID = 0;
	}
	
	
	if (vCounter){
		sLink = buildLink(vID,sLink);
	}
	
	open(sLink, '_blank', winDef);

	if (typeof(vLink.href) != 'undefined')	{
		return false;
	}
}

function buildLink(vID, vLink){
	return vLink
}

function FloatTopDiv(divid,type,eY){
	if (typeof(eY)=='undefined') {eY=0};
	var startX, startY;
	if (type==1) {startX = document.body.clientWidth - 115;} else {startX = 0;}
	if (type==2) {startY = document.body.clientHeight;} else {startY = 0;}
	if (document.body.clientWidth < 980) {startX = -115};

	window.stayFloat=function(ftlObj,type,eY)
	{
		var startX, startY;
		var ns = (navigator.appName.indexOf("Netscape") != -1);
		if (type==1) {startX = document.body.clientWidth - 115;} else {startX = 0;}
		//if (document.body.clientWidth < 980) {startX = -115};
		if (document.body.clientWidth < 980) {
			ftlObj.style.display = 'none';
		} 
		else {
			ftlObj.style.display = '';
			
			if (document.documentElement && document.documentElement.scrollTop)
				var pY = ns ? pageYOffset : document.documentElement.scrollTop;
			else if (document.body)
				var pY = ns ? pageYOffset : document.body.scrollTop;

			if (type==2){
				startY = document.body.clientHeight-183;
			}
			else{
				if (document.body.scrollTop > 71){startY = 3} else {startY = 71};
			}
			ftlObj.y += (pY + startY - ftlObj.y)/8;
			ftlObj.style.left=startX;
			ftlObj.style.top= ftlObj.y + eY;
		}
		setTimeout(function(){stayFloat(ftlObj,type,eY)}, 15);
	}

	var ftlObj = document.getElementById?document.getElementById(divid):document.all?d.all[divid]:document.layers[divid];
	if(!ftlObj) return;
	ftlObj.x = startX;
	ftlObj.y = startY;
	stayFloat(ftlObj,type,eY);
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}