var el = document.getElementById;

var editedLoginUserName = 0;
var editedLoginPassword = 0;

function checkLoginUserName(o) {
	if(editedLoginUserName == 0) o.value = '';
	editedLoginUserName = 1;
}

function checkLoginPassword(o) {
	if(editedLoginPassword == 0) o.value = '';
	editedLoginPassword = 1;
}


function hide(id) {
	document.gelElementById(id).style.display = 'none';
};

function show(id) {
	document.gelElementById(id).style.display = 'block';
};
function showHide(id){
	switch(document.getElementById(id).style.display){
		case 'none' || null : document.getElementById(id).style.display = 'block'; break;
		case 'block': document.getElementById(id).style.display = 'none'; break;
	}
}

function remove(id) {
	document.gelElementById(id).innerHTML = '';
};

Array.find = function(ary, element){
    for(var i=0; i<ary.length; i++){
        if(ary[i] == element){
            return i;
        }
    }
    return -1;
}

//---popup---/
function popupPic(sPicURL) {
	var c = encodeURIComponent(sPicURL)
 var l = eval(screen.width/2 - 320);
 var t = eval(screen.height/2 - 240);
 var data = "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=1,directories=no,location=no,width=200,height=200,left="+l+",top="+t;
 window.open("/popup?"+c, "", data);
}
//*********

//---ajax---

var timout = 5000;
function clear(id){//id vieta html='' un ielade laoding bildi
	
}

function showLoading(id) {
	document.getElementById(id).innerHTML = '<img style=\",argin: 10px 0 0 10px;\" src=\"http://apgerbi.info/img/ajax_loading.gif\"';
}
function loadAjax(id, pre, url){
	var ajax = YAHOO.util.Connect;
	//clear(id);
	//event.returnValue=false;
	showLoading(id);
	location.href = pre + url;
	//return false;
	
	var callback =
	{
	  success: function(o) {
	  	//success(o, divId);
	  	//alert(o.responseText)
	  	document.getElementById(id).innerHTML = o.responseText;
	  	setHash()
	  },
	  failure: function(o) {error(o);},
	  timeout: timout
	}
	var transaction = ajax.asyncRequest('GET', url, callback, null); 
}

function setHash(){
	var hash = window.location.hash;
	var cuttedHash = hash.split("|");
	var cuttedHash2 = cuttedHash[0].split("#");
	var u = cuttedHash2[1]
	
	document.getElementById(cuttedHash2[1]).focus()
}

function changeTab(id){
	
	document.getElementById(id).className = 'active';
}
