// JavaScript Document
function custom(){}
function autoWidth(){
	custom();
	//var scrWidth=document.body.offsetWidth;	
	var scrWidth=document.body.clientWidth;
	//alert(scrWidth)
	var lctWidth=document.getElementById("location");
	var cntWidth=document.getElementById("contentbox");
	//clear width
	if(scrWidth<=1024){
		document.body.style.width=1003+"px";
		lctWidth.style.width=1003-242+"px";
		cntWidth.style.width=1003-242-40+"px";
		//alert("min");
	}
	else if(scrWidth>1024){
		document.body.style.width=scrWidth+"px";
		lctWidth.style.width=scrWidth-242+"px";
		cntWidth.style.width=scrWidth-242-40+"px";
		//alert("max");
	}
	//auto height
	document.getElementById("left").style.height="";
	document.getElementById("location").style.height="";
	var left=document.getElementById("left").clientHeight;
	var content=document.getElementById("location").clientHeight;
	var mainR=document.getElementById("mainR");
	if(left>content){
		mainR.style.height=left+"px";
		document.getElementById("location").style.height=left+"px";
	}
	else if(left<=content){
		mainR.style.height=content+"px";
		document.getElementById("left").style.height=content+"px";
	}
}
window.onload=autoWidth;

function subMenu(btnId,listId,num){
	var btnMenu=document.getElementById("submenu"+btnId);
	var list=document.getElementById("submenuList"+listId);
	if(list.style.display=="block"){
		btnMenu.className="";
		list.style.display="none";
		}
	else{
		for(i=0; i<num; i++){
			document.getElementById("submenuList"+i).style.display="none";
			document.getElementById("submenu"+i).className=" ";
		}
		btnMenu.className="selected";
		list.style.display="block";
	}
	autoWidth();
}
function clearInput(obj){
	obj.value="";
}

function changeBgProPic(ev){
	//var proBox=document.elementFromPoint(event.clientX,event.clientY);//for IE
	if(window.event){
		var obj=event.srcElement;
		obj.attachEvent('onmouseout',BgProPic)
	}
	else{
		var obj=ev.target;
		obj.addEventListener('mouseout',BgProPic(ev),false)//erro for FF
	}
	if(obj.className=="proPicBox"){
		obj.style.backgroundColor="#4b5356";
	}
	
}
function BgProPic(ev){
	if(window.event){
		var obj=event.srcElement;
	}
	else{
		var obj=ev.target;
	}
	obj.style.backgroundColor="#f2f8fb";
}

function showHide(ID, $c_id){
	var objDiv=document.getElementById("popup"+$c_id);
	if(ID=="0"){
		objDiv.style.display="none";
	}
	else{
		objDiv.style.display="block";
	}
	var scrH=document.body.offsetHeight;
	var scrW=document.body.offsetWidth;
	objDiv.style.left=parseInt(scrW/2)-150;
	objDiv.style.top=parseInt(scrH/2)-50;
	//setTimeOut("showHide",2000)
}

function getObjectByClass(oWrapper,tagName,sName){    //get object by class name
    var oClass = [];
    var oTag = oWrapper.getElementsByTagName(tagName);
    
    for(var i=0; i<oTag.length; i++){
        var sClass = oTag[i].className;
        if(sClass == sName){
            oClass.push(oTag[i]);
            }
    }
    return oClass;
 }

function expandFeed(){
	var feedDiv=getObjectByClass(contentbox,div,feed);alert("fd")
	var feedTxtDiv=getObjectByClass(feedDiv,div,feedTxt);
	alert("feedTxtDiv");
	
}

function delete_class($url, $id)
{
	window.location=($url+'='+$id);
}
