function show_news(id)
{
	for(i = 1; i < 6; i++)
	{
		if(i != id)
		{
			obj = fetch_object("top_title" + i);
			obj.className = "unshowed_top_title";
			obj = fetch_object("main_image" + i);
			obj.className = "unshowed_main_image";
			obj = fetch_object("main_title" + i);
			obj.className = "unselected_title";
			obj = fetch_object("details" + i);
			obj.className = "unshowed_details";
		}
		else
		{
			obj = fetch_object("top_title" + i);
			obj.className = "showed_top_title";
			obj = fetch_object("main_image" + i);
			obj.className = "showed_main_image";
			obj = fetch_object("main_title" + i);
			obj.className = "selected_title";
			obj = fetch_object("details" + i);
			obj.className = "showed_details";
		}
		
		
	}
}

function check_comment_form()
{
	name = fetch_object("name");
	if(name.value == "")
	{
		alert("الرجاء عدم ترك الاسم فارغاً");
		return false;
	}
	subject = fetch_object("subject");
	if(subject.value == "")
	{
		alert("الرجاء عدم ترك الموضوع فارغاً");
		return false;
	}
	text = fetch_object("text");
	if(text.value == "")
	{
		alert("الرجاء عدم ترك النص فارغاً");
		return false;
	}
	return true;
}

//#################################################################################
//#################################################################################

function vote()
{
	obj = fetch_object("poll_id");
	id = obj.value;
	option = null;
	for (s = 0; ; s++)
	{
		obj = fetch_object("poll_option" + s);
		if(!obj)
		{
			break;
		}
		if(obj.checked)
		{
			option = obj.value;
		}
	}

	if (option != null)
	{
		window.open("polls.php?actn=vote&id=" + id + "&option="+option, "poll", "height=350, width=600")
	}
	else
	{
		alert('الرجاء تحديد أحد الخيارات');
	}
	return false;
}

//#################################################################################
//#################################################################################

function result()
{
	obj = fetch_object("poll_id");
	id = obj.value;
	window.open("polls.php?actn=result&id=" + id , "poll", "height=350, width=600")
	return false;
}

//#################################################################################
//#################################################################################


function fetch_object(idname)
{
	if (document.getElementById)
	{
		return document.getElementById(idname);
	}
	else if (document.all)
	{
		return document.all[idname];
	}
	else if (document.layers)
	{
		return document.layers[idname];
	}
	else
	{
		return null;
	}
}

