var dom=GetId;

function GetId(Id){
	return document.getElementById(Id);
	}


function refreshBrowser() {
	actual_url = document.location.href;
	window.location = actual_url;
}

function getAbsoluteLeft(objectId) {
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            
	while(o.offsetParent!=null) {   
		oParent = o.offsetParent
		oLeft += oParent.offsetLeft
		o = oParent
	}
	
	return oLeft
}

function getAbsoluteTop(objectId) {
	o = document.getElementById(objectId)
	oTop = o.offsetTop            
	while(o.offsetParent!=null) { 
		oParent = o.offsetParent
		oTop += oParent.offsetTop
		o = oParent
	}

	return oTop
}

function posicionar(objectId,parentTabId,paramLeft,top){//adaptar
oDrop=document.getElementById(objectId);
oDrop.style.left=getAbsoluteLeft(parentTabId) + paramLeft + 'px';
oDrop.style.top=getAbsoluteTop(parentTabId) -top+ 'px';
}


/* FIN */
function displaySort() {
	divSort = GetId('sort');
	if (divSort.style.display=="none") {		
		divSort.style.display="";
		if(navigator.appName == "Microsoft Internet Explorer") {
			posicionar('sort','userMenu', 295, 8);
		}
	} else {
		divSort.style.display="none";
	}
}

function IEdisplayCategories() {
	divCategories = GetId('ie_categories');
	if (divCategories.style.display=="none") {		
		divCategories.style.display="";	
		if(navigator.appName == "Microsoft Internet Explorer") {
			posicionar('ie_categories','userMenu', 295, 8);
		}
	} else {
		divCategories.style.display="none";
	}
}

function displaySearch() {
	divSearch = GetId('search');
	if (divSearch.style.display=="none") {		
		divSearch.style.display="";
		if(navigator.appName == "Microsoft Internet Explorer") {
			posicionar('search','userMenu', 295, 8);
		}
	} else {
		divSearch.style.display="none";
	}
}

function navigateSearch() {
	if (GetId('categorySearch').value != 0) {
		SearchCat = GetId('categorySearch').value;
	} else {
		SearchCat = 0;
	}
	
	if (GetId('vid_name').value != 0) {
		SearchKey = GetId('vid_name').value;
	} else {
		SearchKey = 0;
	}
	window.location = "videos.search-" + SearchCat + "-0-" + SearchKey + "-bysection.html";
}

function closeWindow(divWindow){
	GetId(divWindow).style.display='none';
	refreshBrowser();
	return false;
}

