function doAction(a,id) {
	if (window.confirm("Sure?")) {
		document.actionForm.a.value = a;
		document.actionForm.id.value = id;
		document.actionForm.submit();
	}
	return false;
}

function favorite(fid,type){
	var divId = "div#fav"+fid;
	$(divId).html("<img src='inc/img/load.gif'>");
	$(divId).load("ar.php", 
		{a: 'favorite', fid: fid, type: type},function(){$(divId).animate({height: '100%'}, "slow");}
	);
}


function rate(type,id,stars){
	var divId = 'unit_long'+id+type;
	$("div#"+divId).html("procesing...");
	$.get("ar.php", {a: 'rate', type: type, id: id, stars: stars },function(data){$("div#"+divId).html(data);});
	$("div#"+divId).fadeOut("slow");
	$("div#"+divId).fadeIn("slow",function(){$.get("ar.php", {a: 'get_rating', type: type, id: id },function(data){$("div#"+divId).html(data);});});
}

function comment(type,id,p){
	p = p == undefined ? 1 :p;
	var divId = "div#"+type+id;
	if(p != 1){
		var divHight = $(divId).height();
		$(divId).height(divHight);
	}		
	$(divId).html("Loading...");
	$(divId).load("ar.php", 
		{a: 'comment', type: type, id: id, p:p},function(){$(divId).animate({height: '100%'}, "slow");}
	);
}

function postComment(type,id){
	var divId = 'div#'+type+id;
	var textareaId = '#message'+type+id;
	if ($(textareaId).val().length == 0){
		alert("Please Enter Your Comment!");
	}else{
		var message = $(textareaId).val();
		$.post("ar.php", 
			{a: 'post_comment', type: type, id: id, message: message}
		);
	}
	comment(type,id);
	return false;
}



function SelColor(obj, c){
	obj.className = c;
};

function showhide(id){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none"){ 
			obj.style.display = ""; 
		} else { 
			obj.style.display = "none"; 
		} 
	} 
}


function hide(id){ 
	var obj = document.getElementById(id); 
		obj.style.display = "none"; 
}

function show(id){ 
	var obj = document.getElementById(id); 
		obj.style.display = ""; 
}

function showHideN(id, v){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		if (v == 1){ 
			obj.style.display = ""; 
		} else { 
			obj.style.display = "none"; 
		} 
	} 
}


function setstatus(msg){
	var stat = document.getElementById('status');
	stat.innerHTML = msg;
	showhide('status');
	window.setTimeout("showhide('status')",3000);
}

function openClose(id){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none"){ 
			obj.style.display = "";
			//obj.style.visibility = "visible";
			document.getElementById('sadv').src='/inc/img/b_sadv_close.jpg';
		} else { 
			obj.style.display = "none"; 
			//obj.style.visibility = "hidden";
			document.getElementById('sadv').src='/inc/img/b_sadv_open.jpg';			
		} 
	} 
}

function chImage(img_name, img_src){
   document[img_name].src = img_src;
}

function ocH(v) {
	if(v == 'h'){
		document.getElementById("userC").style.display = "";
	} else {
		document.getElementById("userC").style.display = "none";
	}
}

