/*
function setElement(target,input,mode) 
{	
	HTML_AJAX_Util.setInnerHTML(target,input,mode);
}

function addElements(number)
{
	for (var i=1; i<=number; i++)
	{
		var id = "listCat_"+i;
		var elemObj = document.getElementById(id);	
		if (elemObj != null)
		{
			//elemObj.innerHTML = elemObj.innerHTML.replace(/<script(.*)<\/script>/i, "");
			//elemObj.innerHTML = elemObj.innerHTML.replace(/id_category/i, "id_category2");
			var sourceObj = opener.document.getElementById('target1');
			if (sourceObj != null)
			{
				elemObj.innerHTML = "<div id=\"listCat_"+i+"\">" + elemObj.innerHTML + "</div>";
				setElement(sourceObj,elemObj.innerHTML,'append');
			}
		}	
	}			
}
*/
/*
function testType(thisId,needleId,needle) 
{
	var selectObj = document.getElementById(thisId);
	if (selectObj!=null)
	{
		var type = selectObj[selectObj.selectedIndex].value;
		if (type == needle)
			ShowHide(needleId,"block");
		else
			ShowHide(needleId,"none");
	}
}
*/

function AddCategory(count)
{
	for (var i=1; i<=count; i++)
	{
		var id = "listCat_"+i;
		var elemObj = document.getElementById(id);	
		id = "status_listCat_"+i;
		var elemObj2 = document.getElementById(id);	
		if (elemObj != null && elemObj2 != null)
		{
			if (elemObj.style.display == "none")
			{
				elemObj.style.display = "block";
				elemObj2.value = 1;
				break;
			}
		}	
	}	
}

function DelCategory(id,id_select)
{
	var elemObj = document.getElementById(id);
	id = "status_"+id;
	var elemObj2 = document.getElementById(id);	
	if (elemObj != null && elemObj2 != null)
	{
		elemObj.style.display = "none";
		elemObj2.value = -1;		
	}	
}	

function ShowHide(id,display)
{
	var obj=document.getElementById(id);	
	if (obj != null)
	{
		if (obj.style.display == "block" || display == "none")
		{
			obj.style.display = "none";		
		}		
		else if (obj.style.display == "none" || display == "block")
		{
			obj.style.display = "block";
		}
	}	
}

function resizeBlocks()
{
	var leftBanner = document.getElementById('leftBanner');
	var indexTop = document.getElementById('indexTop');
	if (leftBanner != null && indexTop != null)
	{
		if (leftBanner.clientHeight>655)
		{
			indexTop.style.width = "78%";
		}
		else
		{
			indexTop.style.width = "100%";
		}
	}
}

function confirmAction(url,message) 
{
	if (confirm(message)) 
	{
		window.location.href=url;
	}
}

function fillUserInfo(id)
{
	var index = "";
	var selectValue = 0;
	var obj = window.document.getElementById(id);
	
	if (obj != null)
	{
		var login = window.document.getElementById("login");
		var pwd = window.document.getElementById("password");
		var pwd2 = window.document.getElementById("re_password");
		var email = window.document.getElementById("email");
		
		if (login != null && pwd != null && pwd2 != null && email != null)
		{	
			index = obj.selectedIndex;
			selectValue = obj[index].value;
			if (usersArray[selectValue] != null)
			{
				login.value = usersArray[selectValue][0];
				pwd.value = usersArray[selectValue][1];
				pwd2.value = usersArray[selectValue][2];
				email.value = usersArray[selectValue][3];
			}
			else
			{
				login.value = "";
				pwd.value = "";
				pwd2.value = "";
				email.value = "";
			}
		}
	}
}

 function changeType(type)
 {
 	var htmlCode = window.document.getElementById("codeHtml");
 	if (htmlCode!=null)
 	{
 		var codeHtml = htmlCode.value;
		if (codeHtml.search(/&type=(.*) width/i) != -1)
			new_CodeHtml=codeHtml.replace(/&type=(.*) width/gi, "&type="+type+" width");
		
		if (new_CodeHtml)
			htmlCode.value = new_CodeHtml;
 	}
 }
 
function openWindow(url,id,w,h) 
{
	if (!w)
		w=500;
	if (!h)
		h=600;
		
	url = url;
	window.open(url,'popupWindow'+id,'width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,screenX=150,screenY=150,top=150,left=150');
} 

function RolloverImgs(img,ref,path) 
{ 
	var img_path = "img/";
	obj = document.images[img];
	if (obj)
	{
		ref = img_path + path + "/" + ref;
		obj.src = ref;
	}
} 