// JavaScript Document

var http=gethttp(); 

function gethttp()
{
var xmlhttp;	
	try
		{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");	}
	catch(e)
		{ try
		  { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")}
		  catch (e)
		  {
			if (typeof XMLHttpRequest !='undefiend')
			{ xmlhttp = new XMLHttpRequest();				}
			}}	
	return xmlhttp;
}

// ---------------------------------------------------------- Show Short News

function Ans_short()
{
	if(http.readyState == 4)
		{
			r = http.responseText;
			document.getElementById('newstd').innerHTML = r;
			http=gethttp();
			tdmuch('tdmu1');
		}
}

function prnt(id)
{
	var ur="printmng.php?id="+id;
	window.open(ur,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=820, height=700, top=75, left=100")
	
}


var shr_news ="functions/short_news.php?id=";
function news_short(id,idtd)
{
	bg_pic(idtd);
	http.open("GET",shr_news+id,true);
	http.onreadystatechange=Ans_short;
	http.send(null);
}


// -------------------------------

var iddd = 0;
function bg_pic(i)
{
tmp2 = iddd;
iddd = i;
if (tmp2 != i)
	{
	document.getElementById(i).style.background = "url(images/main/back_tab.jpg)"; 
	if (tmp2 != 0)
		{
		document.getElementById(tmp2).style.background = ""; 
		}
	}
}




var mag = 0;
var temp = 0;
var sr="bok_val.php?id=";
function sour(id)
{
if (id != mag)
	{
	temp = mag;
	mag = id;
	op="images/bookopen.gif";
	cl="images/book.gif";
	document.getElementById(mag).src = op;
	if (temp != 0) document.getElementById(temp).src = cl;
	document.getElementById('tdre').src = sr+id;

	}
}


function ovsub()
	{
	document.getElementById('sb1').src = "images/mallay/sub_2.png";
	}

function ousub()
	{
	document.getElementById('sb1').src = "images/mallay/sub_1.png";
	}	

function hily()
{
	xLay = document.getElementById('mailth');
	xLay.style.visibility = "hidden";
}
	
function shly(e)
{
	if (!e) e = window.event;
	mxx =  e.clientX;
	window.scrollTo(0,document.height);
//	alert (document.body.clientHeight);

//	mye = document.height - 450;
	mye = document.body.clientHeight - 450;
	mye += 'px';
	
	xLay = document.getElementById('mailth');
	xLay.style.left = mxx + 30  + 'px';
	xLay.style.top  = mye;
	xLay.style.visibility = "visible";
}
	
function frmail()
{
mlchk =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	if (document.getElementById('sname').value.length < 3)
		{
			alert ("Your First Name is Required");
			return false;
		}
	if (document.getElementById('slast').value.length < 3)
		{
			alert ("Your Last Name is Required");
			return false;
		}	
	if (document.getElementById('smail').value.length < 3)
	{
		alert ("Your E-mail Address is Required");
		return false;
	}
	if (!mlchk.test(document.getElementById('smail').value)) 
	{
		alert ("Your E-mail Address is not Correct");
		return false;
	}
	if (document.getElementById('fname').value.length < 3)
		{
			alert ("Recipient's First Name is Required");
			return false;
		}
	if (document.getElementById('flast').value.length < 3)
		{
			alert ("Recipient's Last Name is Required");
			return false;
		}	
	if (document.getElementById('fmail').value.length < 3)
		{
		alert ("Recipient's E-mail Address is Required");
		return false;
		}
	if (!mlchk.test(document.getElementById('fmail').value)) 
		{
		alert ("Recipient's E-mail Address is not Correct");
		return false;
		}
	document.getElementById('mlth').submit();
}


var muelm = 'tdmu1';
function tdmuch(id)
{
	document.getElementById(muelm).style.background = "#BBDC95";
	muelm = id;	
	document.getElementById(id).style.background = "url(images/homebox/back_tab.png)";
	if (id == 'tdmu1') idsend = 1;
	if (id == 'tdmu2') idsend = 2;
	if (id == 'tdmu3') idsend = 3;
	if (id == 'tdmu4') idsend = 4;
	urlmusic = "functions/readmusic.php?id=";
 	http.open("GET",urlmusic+idsend,true);
	http.onreadystatechange=show_music;
	http.send(null);
}

function show_music()
{
	if(http.readyState == 4)
		{
			r = http.responseText;
			document.getElementById('shmusic').innerHTML = r;
		}
}


function strmusic(id)
{
window.open("playmusic.php?id="+id , "_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=230, height=100, top=75, left=100")
}

function onchst(nxn)
	{
	document.getElementById(nxn).style.background = "#CCCCCC";
	}


function utchst(nxn)
	{
	document.getElementById(nxn).style.background = "#92B66D";
	}	



function updsub()
	{
	lenfrm = document.sndfrm.length;
	var mycnt = new Number();
	
	for (mycnt ; mycnt<lenfrm ; mycnt++)
		{
		mongol = parseInt(mycnt);
		if (document.sndfrm.elements[mongol].type != 'text')    document.sndfrm.elements[mongol].checked = false;
		}
	document.sndfrm.action = "updbas.php";
	document.sndfrm.submit();
	
	}
