IE = (document.all); // Internet Explorer
NC = (document.layers); // Netscape
Opera = (document.getElementById); // Opera

URI = "http://inforu.tv/";

URI_ADMIN = "http://inforu.tv/";

function sh_answer(id){
	if(document.getElementById('d_'+id).style.height=='1px') {
		document.getElementById('d_'+id).style.height='auto';
		document.getElementById('a_'+id).className="list_expanded";
	}
	else {
		document.getElementById('d_'+id).style.height='1px';
		document.getElementById('a_'+id).className="list_collapsed";
	}
}

function getElementsByClass(searchClass,node,tag) {

        var classElements = new Array();
        if (node == null)
                node = document;
        if (tag == null)
                tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
        var j = 0;
        for (i = 0; i < elsLen; i++) {
                if (pattern.test(els[i].className) ) {
                        classElements[j] = els[i];
                        j++;
                }
        }
        return classElements;
}

function popUpWindow(URLStr, left, top, width, height)
{
  window.open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function show_error(fieldName,message){
	if(fieldName!=null || fieldName!="") eval("document.getElementById('label_"+fieldName+"').className = 'red'");
	if(message==null) message="Заполните пожалуйста выделенные поля!";
	document.getElementById('error').innerHTML=message;
	document.getElementById('error').style.visibility='visible';
	document.getElementById('error').style.padding="5px";
	document.getElementById('error').style.height='';;
	
}

function hide_error(showMessage){
	var labels=document.getElementsByTagName("label");	
	
	for(i=0; i < labels.length; i++) if(eval('labels['+i+'].id.substr(0,5)')=='label') eval("labels["+i+"].className=''");
	document.getElementById('error').style.visibility='hidden';
	document.getElementById('error').style.padding="0px";
	document.getElementById('error').style.height="1px";
}

function goTo(URL, target){
	if(target==null) target='parent';
	if(navigator.appName=="Netscape") eval('window.'+target+'.location = "'+URL+'"');
	else eval('window.'+target+'.navigate("'+URL+'")');
}

function showBlend() {
	document.getElementById('blend').style.visibility='visible';
}

function hideBlend() {
	document.getElementById('blend').style.visibility='hidden';
}

function imgPreview(id) {
	document.getElementById('img_frame').innerHTML='<img src="image.php?id='+id+'" />';
	showBlend();
	document.getElementById('img_frame').style.visibility='visible';
}

function closePreview() {
	document.getElementById('img_frame').style.visibility='hidden';
	hideBlend();
}
