var rsid = 1;
var frameon = 0;
var pack = 0;
function popup(text, flag){
	msg_panel = document.getElementById("messages_panel");
	if (flag==1){
		msg_panel.innerHTML+= "<br /><b class='warning'>"+text+"</b>";  
	}else{
		msg_panel.innerHTML = '';  
	}
}
function play_music(music_file){
	var oDiv = document.createElement("Div");
	document.body.appendChild(oDiv);
	oDiv.setAttribute("style", "display:inline", 0);
	oDiv.setAttribute("id", "music_panel", 0);
	oDiv.innerHTML = '<embed hidden="false" volume="90" src="'+music_file+'" autostart="true" playcount="1" loop="false" width="0" height="0"></embed>';
}
function getonline(){
	rsid++;
	var panel = document.getElementById("onlinepanel");
	//alert(document.getElementById("xfield"));
	if (document.getElementById("xfield")!=null){
		var x = document.getElementById("xfield").value;
	}else x=0;
	
	var doc_href = document.location.href;
	doc_href = doc_href.substr(0, (doc_href.lenght-doc_href.lastIndexOf('/')));
	var href = doc_href+"/include/online.php?x="+x+"&rsid="+rsid;

	var oldframe = document.getElementById("onlinehref");
	if (oldframe!=null){
		panel.removeChild(oldframe);
	}
	iframe = panel.appendChild(document.createElement("iframe"));
	iframe.style.display = 'inline';
	iframe.setAttribute("id", "onlinehref", 0);
	iframe.setAttribute("src", href, 0);
	iframe.setAttribute("border", "0", 0);
	iframe.setAttribute("width", "540", 0);
	iframe.setAttribute("class", "online", 0);
	setTimeout("getonline()", 60000);
}
function open_ps(id, read, sid){
	var win = window.open("forms/ps.php?user="+id+"&read="+read+"&sid="+sid, "win",
		"width=412,resizable=no,toolbar=no,location=no,scrollbars=no,height=150", false);
	return false;
}
function sh(id){
	var item = $(id);
	if (item){
		if (item.style.display == 'none') item.style.display = 'inline';
		else item.style.display = 'none';
	}
}
function select_pack(id, pack_name){
	var tr = $('pack_'+id);
	tr.className='lsand';
	if (pack) $('pack_'+pack).className = 'ldark';
	pack = (pack == id) ? 0 : id; 
	if (pack){
		$('selected_pack').innerHTML = '<a href="http://www.stakanoff.net/main.php?show=gallery&pack_id='+id+'">'+pack_name+'</a>';
		$('pck_id').value = id;
		$('send_btn').disabled = false;
		$('upload_fotos').style.display = 'inline';
	}else{
		$('selected_pack').innerHTML = '<b class="warning">-</b>';
		$('upload_fotos').style.display = 'none';
	}
}
function drop_pack(id, pack_name){
	 return confirm('Uveren chto hochesh udalit pachku: "'+pack_name+'" ?');
}
function check_fields(){
	if (($('p1').value) || ($('p2').value) || ($('p3').value)) return true;
	else return false;
}
function pic_now(path){
	$('pict_now').src = path;
}