
	/***
	 * Definition of const
	*/
	var WRP = '/';
	var WIMGP = WRP + 'lib/img/';
	var WJSP  = WRP + 'lib/js/';
	var WFUNP = WRP + 'lib/functions/';
	var WINCP = WRP + 'lib/inc/';
	var BUGLOLJSSEPARATOR = "<!?@#--BUGLOLDEFINEDJSSEPARATOR--#@?!>";
	var __NEWPPWIN = true;
	var $ = function(o,x)
	{
		switch(x)
		{
			case 1:return docuemnt.getElementsByTagName(o);
			case 2:return document.getElementsByName(o);
			default:return document.getElementById(o);
		}
	}
	function XY(e) 
	{
	        var t=e.offsetTop; 
		var l=e.offsetLeft;
		var w=e.offsetWidth;
		var h=e.offsetHeight;
		while(e=e.offsetParent) 
		{ 
			t+=e.offsetTop; 
			l+=e.offsetLeft; 
		}
		return [t,l,w,h]; 
	} 
	function precise(x,u)
	{
		x = parseFloat(x);
		u = parseFloat(u);
		if(!u){u=2;}
		return x.toFixed(u);
	}
	function removeAllOptions(obj)
	{
		while(obj.options.length)
		{
			obj.remove(0);
		}
	}
	function addAnOption(obj,text,value)
	{
		obj.options[obj.options.length] = new Option(text,value);
	}
	function getExHTML(o)
	{
		var selectobj,inputobj,textobj,txtinput=[],rcinput=[];
		if(/msie/i.test(navigator.userAgent.toLowerCase())){return o.innerHTML;}
		if(typeof(o)=='object')
		{
			selectobj = o.getElementsByTagName("select");
			for(i=0;i<selectobj.length;i++)
			{
				for(var j=0;j<selectobj[i].options.length;j++)
				{
					if(j==selectobj[i].selectedIndex)
					{
						selectobj[i].options[j].setAttribute("selected","selected");
					}else{
						selectobj[i].options[j].removeAttribute("selected");
					}
				}
			}
			inputobj = o.getElementsByTagName("input");
			for(i=0;i<inputobj.length;i++)
			{
				switch(inputobj[i].type)
				{
					case "text":txtinput.push(inputobj[i]);break;
					case "radio":rcinput.push(inputobj[i]);break;
					case "checkbox":rcinput.push(inputobj[i]);break;
				}
			}
			for(j=0;j<txtinput.length;j++)
			{
				txtinput[j].setAttribute("value",txtinput[j].value);
			}
			for(j=0;j<rcinput.length;j++)
			{
				if(rcinput[j].checked)
				{
					rcinput[j].setAttribute("checked","checked");
				}else{
					rcinput[j].removeAttribute("checked");
				}
			}
			textobj = o.getElementsByTagName("textarea");
			if(textobj.length)
			{
				textobj = textobj[0].value;
			}else{textobj='';}
		}
		return o.innerHTML.replace(eval("/(<textarea[^>]*>)[\\d\\D]*?<\\/textarea>/"),"$1"+textobj+"</textarea>");
	}
var Ajax = function ()
{
	this.MODE = "POST";
	this.xmlHttpObject = function ()
	{
		if (window.XMLHttpRequest)
		{ // Mozilla, Safari, ...
			httpRequest = new XMLHttpRequest();
			if (httpRequest.overrideMimeType) {
				httpRequest.overrideMimeType('text/html');
			}
		}else if (window.ActiveXObject){ // IE
			try{
				httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try {
					httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				}catch (e){}
			}
		}
		if (!httpRequest) {
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}
		return httpRequest;
	}
	this.loadHttp = function (url,callback,data)
	{
		var xmlHttp = this.xmlHttpObject();
		if(/gecko/i.test(navigator.userAgent.toLowerCase()))
		{//firefox security across access
			try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) {}
		}
		xmlHttp.open(this.MODE,url,true);
		xmlHttp.setRequestHeader("Cache-Control","no-cache");
		xmlHttp.setRequestHeader("If-Modified-Since",new Date(0));
		xmlHttp.setRequestHeader("Content-length", data.length); 
		xmlHttp.setRequestHeader("Connection", "close");
		
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState==4)
			{
				typeof(callback)=="function"?callback(xmlHttp):alert("callback shoud be a function");
			}
		}			

		this.MODE == "POST"?(xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xmlHttp.send(data)):xmlHttp.send();
	}
}
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function drag(o)
{
	me = this;
	var dragBox;
	o.onmousedown = function(e)
	{
		dragBox = document.createElement("div");
		o.parentNode.appendChild(dragBox);
		with(dragBox.style){
			position = "absolute";
			top = this.style.top;
			left = this.style.left;
			width = o.style.width;
		 	height = o.style.height;
		 	border = "2px dashed gray";
		}
	
		e = e||event;
		dragBox.oOffset = (e.layerX)?{x:e.layerX,y:e.layerY}:{x:e.offsetX,y:e.offsetY};
		document.onmousemove = me.drag;
		document.onmouseup   = me.drop;
		document.onselectstart = function(){return false;};
		if(window.BUGLOLUNIQUEID_newsPlayer)window.BUGLOLUNIQUEID_newsPlayer.halt();
	}
	this.drag = function(e)
	{
		//o.getElementsByTagName("div")[0].style.visibility = 'hidden';
		//o.style.border = "2px dashed blue";
		var y = document.body.scrollHeight;
		var x = document.body.scrollWidth;
		var t = ietruebody().scrollTop;
		var l = ietruebody().scrollLeft;
		e=e||event;

		var top = e.clientY - dragBox.oOffset.y + t;
		var left = e.clientX - dragBox.oOffset.x + l;
		top = (top<0) ? 0 : ((top>y-dragBox.offsetHeight) ? (y-dragBox.offsetHeight) : top);
		left = (left<0) ? 0 : ((left>x-dragBox.offsetWidth) ? (x-dragBox.offsetWidth) : left);
		dragBox.style.top  = top + "px";
		dragBox.style.left = left + "px";
	}
	this.drop = function()
	{
		o.style.top = dragBox.style.top;
		o.style.left = dragBox.style.left;
		o.parentNode.removeChild(dragBox);
		document.onmousemove = document.onmouseup = document.onselectstart = null;
		if(window.BUGLOLUNIQUEID_newsPlayer)window.BUGLOLUNIQUEID_newsPlayer.start();
	}
}
function generateDialogHTML($width,$height,$mode)
{
	$mode = $mode || false;
	return ($mode?"<div class='dialog' style='width:"+$width+"px;height:"+$height+"px;'>":"")+"<div class='dialog_tl'></div><div class='dialog_tm' style='width:"+($width-34)+"px;'><span id='dialog_title' style='width:"+($width-75)+"px;'></span><a href='#' onclick='return closeDialog()' onmousedown='cancelBubbleEx(event)'></a><br clear=both></div><div class='dialog_tr'></div><br clear=both><div class='dialog_ml' style='height:"+($height-60)+"px'></div><div id='dialog_content' onmousedown='cancelBubbleEx(event)' class='dialog_mm' style='width:"+($width-34)+"px;height:"+($height-60)+"px'></div><div class='dialog_mr' style='height:"+($height-60)+"px'></div><br clear=both><div class='dialog_bl'></div><div class='dialog_bm' style='width:"+($width-34)+"px'></div><div class='dialog_br'></div><br clear=both>"+($mode?"</div>":"");

}
function Dialog_show_content($title,$content,$width,$height,$resize)
{
	try{

		$("dialog_title").innerHTML = $title.replace(/{[$]systemico:(\d)}/,"<img src='"+WIMGP+"ico/$1.gif'>");
		$("dialog_content").innerHTML = $content;
		$("bottom_mask").style.display = 'block';
		$("bottom_mask").style.height = document.body.scrollHeight + "px";
		$("bottom_dialog").style.display = 'block';
	}catch(e){alert(e.message || e.description)}
}
function showDia($title,$content,$width,$height,$resize)
{
	if(arguments.length==2){$width=500;$height=400;}
	var masktop = (parseInt(ietruebody().scrollTop) + 126);
	var maskContent;
	$resize = $resize || false;
	if($resize || $("bottom_dialog").style.display == 'none'||$("bottom_dialog").style.display == '')
	{
		$("bottom_dialog").style.top = masktop +"px";
		$("bottom_dialog").style.left = (parseInt(document.body.scrollWidth / 2) - ($width / 2)) + "px";
	}
	$("bottom_dialog").style.width = $width + "px";
	$("bottom_dialog").style.height = $height + "px";

	try
	{
		$("bottom_dialog").innerHTML = generateDialogHTML($width,$height);
		Dialog_show_content($title,$content,$width,$height,$resize);
	}catch(e){alert(e.message || e.description);}

}
function closeDialog()
{
	$("bottom_mask").style.display = 'none';
	$("bottom_dialog").style.display = 'none';
	return false;	
}
function cancelBubbleEx(evt)
{
	var e=(evt)?evt:window.event;  
	if (window.event) {  
		e.cancelBubble=true;  
	} else {  
		e.stopPropagation();  
	} 
}
var imgo;
function enlarge(u,url)
{
	
	if(/(.*)_1\.jpg$/.test(u.src)||url)
	{
		showDia("Tony about","<p align='center'><img src='"+WIMGP+"imgloader.gif'><br/>Loading...</p>",350,200);
		imgo = new Image();
		imgo.onload = function()
		{
			//closeDia();
			showDia("Tony about","<p align='center'><img src='"+this.src+"'>",this.width+50,this.height+50,true);
		}

		imgo.src = url?url:u.src.replace(/(.*)_1\.jpg/,"$1.jpg");

	}else{
		try{
			closeDia();
			imgo.onclick = function(){enlarge(u)};
			imgo.src = u.src.replace(/(.*?).jpg/gi,'$1_1.jpg');
			imgo.onload = null;
			imgo.onclick = null;
			imgo.src = '';
			imgo = null;
			
		}catch(e){alert(e.message || e.description);}

	}
}
function createDialogEx(content)
{
	return "\
	<div class='dialogex_bg'>\
	<div class='dialogex_close'><img style='cursor:pointer;' onclick='closeDialogEx(this)' src='"+WIMGP+"closepng.png'></div>\
	<div class='dialogex_content'>"+content+"</div>\
	</div>";
}
function closeDialogEx(o)
{
	try{
		o.parentNode.parentNode.style.display = 'none'	;
	}catch(E)
	{}
}
function startchat()
{
	$("footer").innerHTML = createDialogEx('<br><br><br/><table cellpadding="0" cellspacing="0" border="0"><tr><td align="center" id="livechtainstance1" onclick="closeDialog()"><a href="http://livechat.boldchat.com/aid/7029280146625386989/bc.chat?cwdid=6309818189158133977" target="_blank" onClick="window.open(\'http://livechat.boldchat.com/aid/7029280146625386989/bc.chat?cwdid=6309818189158133977&amp;url=\' + escape(document.location.href), \'Chat3899553479703554356\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480\');return false;"><img alt="Live chat by BoldChat" src="http://cbi.boldchat.com/aid/7029280146625386989/bc.cbi?cbdid=3644495516326338724" border="0" /></a></td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td align="center" id="livechtainstance1" onclick="closeDialog()"><a href="http://livechat.boldchat.com/aid/773932938319613476/bc.chat?cwdid=5789156915064705278" target="_blank" onClick="window.open(\'http://livechat.boldchat.com/aid/773932938319613476/bc.chat?cwdid=5789156915064705278&amp;url=\' + escape(document.location.href), \'Chat6551251341491986138\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480\');return false;"><img alt="Live chat by BoldChat" src="http://cbi.boldchat.com/aid/773932938319613476/bc.cbi?cbdid=7165905985978231007" border="0" /></a></td></tr></table>')
	//showDia('Tony live chat','',300,250,false);
}
var AX = new Ajax();
