﻿function gE(x){return document.getElementById(x);}
function gETop(x){var t=0;while(x){t+=x.offsetTop;x=x.offsetParent;}return t;}
function gEBottom(x){return (x.offsetHeight+gETop(x));}
function gELeft(x){var l=0;while(x){l+=x.offsetLeft;x=x.offsetParent;}return l;}
function gERight(x){return (x.offsetWidth+gELeft(x));}

function shiftcity(obj)
{
	if(!obj)
	{
		return;
	}
	var citylist = getNames(gE("ct_content"), "city", "a");
	strUrlKey = obj.getAttribute("urlkey");
	strUrlName = obj.getAttribute("urlname");
	$(obj).parent().parent().addClass("active");
	for(i = 0; i < citylist.length; ++ i)
	{
		if(citylist[i].getAttribute("urlkey") != strUrlKey)
		{
			$(citylist[i]).parent().parent().removeClass();
		}
	}
	strUrl = "/ajax/index_tejia.asp?from="+strUrlName;
	
	$.ajax({ url: strUrl, context: document.body, success: function(data){
			$("#tj_content").html(data);
	      }});
}

function getNames(obj,name,tij)
{	
	var plist = obj.getElementsByTagName(tij);
	var rlist = new Array();
	for(i=0;i<plist.length;i++)
	{
		if(plist[i].getAttribute("name") == name)
		{
			rlist[rlist.length] = plist[i];
		}
	}
	return rlist;
}

function getElementByName(obj,name,tij)
{	
	var plist = obj.getElementsByTagName(tij);
	for(i=0;i<plist.length;i++)
	{
		if(plist[i].getAttribute("name") == name)
		{
			return plist[i];
		}
	}
	return null;
}

