function dw(str){
	document.write(str);
}

function wait()
{
	window.setInterval("load()", 360000);
}
function load()
{
		document.location.reload();
}

function replaceSpecialChars(str)
{		
	while (str.indexOf("&quot;")!=-1)
		str = str.replace("&quot;",'~');
	
	while (str.indexOf("'")!=-1)
		str = str.replace("'",'*');	
		
	while (str.indexOf("&amp;")!=-1)
		str = str.replace("&amp;",'^');	
		
	while (str.indexOf("&")!=-1)
		str = str.replace("&",'^');	
			
	return str;
}

function bannerNew(noPosition,l1,l2,l3,l4,posSrcs,positionStr,env)
{
	var params = document.location.search.split("&");
	var pos = 0,sectionLayer="",check=false;
	for(var i=0;i<params.length;i++){
		if(params[i].split("=")[0] == "layer" || params[i].split("=")[0] == "?layer"){
			pos = i;
			check=true;
			break;
		}
	}
	if(check){
		sectionLayer = params[pos].split("=")[1];
	}
	else{
		sectionLayer = "hp";
	}
	var cookieContent = new String(document.cookie);
	var site = "themarker";
	var now = new Date();
	var RND = now.getSeconds();
	var frameUrl = "http://dclk"
	var domainName = new String(self.location);
	frameUrl += ".themarker.com/html.ng/site=" + site + "&sectionLayer=" + sectionLayer + "&adsize=" + posSrcs + "&" + (l1=="none"?"":"layer="+l1+"&") + (l2=="none"?"":"layer2="+l2+"&") + (l3=="none"?"":"layer3="+l3+"&") + (l4=="none"?"":"layer4="+l4+"&") + "adtype=hp&page_position=" + noPosition + "&Rnd=" + RND;
	if (env == "dev" )
		frameUrl += "&stg=5" ;
	//frameUrl = "";  //problem in dclk
	dw("<IFRAME " + positionStr + " MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR=000000 SRC=\"" + frameUrl + "\"></IFRAME>");
	dw('</div>');	
}

function bannerJS(pagePosition,site,layer,width,height)
{
	if (pagePosition != null)
		dw("<script src='http://dclk.themarker.com/js.ng/page_position="+pagePosition+"&site="+site+"&adsize="+width+"x"+height+"&layer="+layer+"'></script>");
	else
		dw("<script src='http://dclk.themarker.com/js.ng/site="+site+"&adsize="+width+"x"+height+"&layer="+layer+"'></script>");
}

function buildURLNew(fld)
{
	if (fld == "") return false;
	var encodedField = "";
	var s = fld;
	if (typeof encodeURIComponent == "function")
	{
		// Use JavaScript built-in function
		// IE 5.5+ and Netscape 6+ and Mozilla
		encodedField = encodeURIComponent(s);
	}
	else 
	{
		// Need to mimic the JavaScript version
		// Netscape 4 and IE 4 and IE 5.0
		encodedField = encodeURIComponentNew(s);
	}	
	return encodedField;
}



/*tags functions*/

var timerHideTagDiv;	
var isShow = false;

function replaceSpecialChars(str)
{		
	while (str.indexOf("&quot;")!=-1)
		str = str.replace("&quot;",'~');
	
	while (str.indexOf("'")!=-1)
		str = str.replace("'",'*');	
		
	while (str.indexOf("&amp;")!=-1)
		str = str.replace("&amp;",'^');	
		
	while (str.indexOf("&")!=-1)
		str = str.replace("&",'^');	
			
	return str;
}

function replaceSpecialCharsBack(str)
{	
	while (str.indexOf('~')!=-1)
		str = str.replace('~',"&quot;");
	
	while (str.indexOf('*')!=-1)
		str = str.replace('*',"'");	
		
	while (str.indexOf('^')!=-1)
		str = str.replace('^',"&");	
		
	return str;
}

function replaceSpace(str)
{	
	re = new RegExp(' ','g');
	return str.replace(re, '%20');	
}

function showTagsDiv(loadevt,x, slug, startPlace)
{	
	var val,obj;
	var crossevt=(window.event)? event : loadevt;		
	hideTagsDivNow();
	
	if (startPlace == null)
		startPlace = 1;
	
	var countTags = 0;
	var tableInDiv = '<table style="width:83px;" cellpadding="0" cellspacing="0" border="0" width="100%" dir="rtl">';
				
	for (var cnt = startPlace; cnt < 4; cnt++){
		eval("val = valArr"+slug+"["+cnt+"]");			
		if (val != ""){
			countTags = countTags + 1;		
			tableInDiv = tableInDiv + "<tr><td nowrap id=tag"+cnt+" style='padding-right:7px;padding-left:7px; height:17px;' onmouseover=onmouseOverTagLine(true,"+cnt+"); onmouseout=onmouseOverTagLine(false,"+cnt+");><a target='_top' id=tagText"+cnt+" class=tagLineTxt href='/web2/tags.jhtml?tag="+replaceSpace(val)+"'>"+replaceSpecialCharsBack(val)+"</a></td></tr>";		
		}
	}	
	tableInDiv = tableInDiv + "</table>";
	
	obj = document.getElementById("tagsDiv");	
	if (obj){				
		obj.innerHTML = tableInDiv;		
		obj.style.height = countTags*17+2;		
		
		obj.style.left = getAbsolute(x)[0]-80;
		
		if (crossevt.clientY < 400)			
		 	obj.style.top = getAbsolute(x)[1]-20;
		else
		 	obj.style.top = getAbsolute(x)[1]-62+(3-countTags)*17;
		
		obj.style.display = 'block';
	}		
}
	
function keepShowingTagsDiv()
{		
	isShow = true;
	var obj = document.getElementById("tagsDiv");
	if (obj)
		obj.style.display = 'block';
}
	
function hideTagsDivNow()
{	
	isShow = true;
	var obj = document.getElementById("tagsDiv");
	if (obj)
		obj.style.display = 'none';
}

function hideTagsDiv()
{
	window.clearInterval(timerHideTagDiv);
	timerHideTagDiv = "";		
	isShow = false;
	timerHideTagDiv = setTimeout("hideTagsDivAfterWaiting()", 2000); 
}

function hideTagsDivAfterWaiting()
{		
	if (isShow == false)
	{
		window.clearInterval(timerHideTagDiv);
		timerHideTagDiv = "";			
		hideTagsDivNow();		
	}
}
	
function onmouseOverTagLine(isIn,cnt)
{	
	var obj = document.getElementById("tag"+cnt);
	var objA = document.getElementById("tagText"+cnt);
	if (obj)	
	{
		if (isIn == true)//in
			obj.className = 'tagBack';
		else//out
			obj.className='';
	}
	if (objA)	
	{
		if (isIn == true)//in
			objA.className = 'tagLineTxtOver';
		else//out
			objA.className = 'tagLineTxt';
	}
}

function onmouseOverTag(isIn,elm)
{
	if (isIn == true)//in
		elm.className='tagBack';					
	else//out
		elm.className='';		
}

function onmouseOverTagText(isIn,elm)
{
	if (isIn == true)//in
		elm.className='tagsTextOver';					
	else//out
		elm.className='tagsText';			
}	

function onmouseOverTagInComments(isIn,elm)
{
	if (isIn == true)//in
		elm.className='tagBack tagsTextOver';					
	else//out
		elm.className='tagsText';			
}

function onMouseOverSendEmailImgInArticle(isIn,objName)
{	
	var obj = document.getElementById(objName+"Img");
	var imgName;
	if (obj)
	{
		if (isIn == true)
			imgName = "/tmc/i/article/"+objName+"_on.gif";			
		else
			imgName = "/tmc/i/article/"+objName+"_off.gif";
		obj.src = imgName;
	}
}

function onMouseOverPrintImgInArticle(isIn,objName)
{
	if (isIn == true)
		document.getElementById(objName).src="/tmc/i/article/print_on.gif";
	else
		document.getElementById(objName).src="/tmc/i/article/print_off.gif";
}

function onmouseOverTagTextGen(isIn,elm,className)
{
	
	if (isIn == true){//in
		elm.className='tagsTextOverBlack';
	}				
	else{//out
		if (className){
			elm.className = className + ' noTextDecoration';
		}
	}			
}		