// JavaScript Document
function setCookie(c_name,c_value)
{
	document.cookie=c_name+"="+c_value+";";
}
function getCookie(c_name)
{
	if (document.cookie.length>0)
  	{
  		c_start=document.cookie.indexOf(c_name + "=");
  		if (c_start!=-1)
    	{
    	c_start=c_start + c_name.length+1;
    	c_end=document.cookie.indexOf(";",c_start);
    		if (c_end==-1) c_end=document.cookie.length;
    		return unescape(document.cookie.substring(c_start,c_end));
    	}
  	}
	return "";
}
function getVal(id)
{	
	if(document.getElementById(id))	return document.getElementById(id).value;
	else return -1;
}
function getObj(id)
{
		return document.getElementById(id);
}
function checkEmail(mail) 
{
	var email = mail;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) 
	{
		return false;
	}
	else return true;
}

function CheckAll(id) 
{
	var rows = document.getElementsByTagName('input');
	var checkbox;
	for ( var i = 0; i < rows.length; i++ ) 
	{
		checkbox = rows[i];
		if ( checkbox && checkbox.type == 'checkbox' && checkbox.id==id) 
		{
			checkbox.checked = !checkbox.checked;
		}
	}
	return true;
}
function ShowHide(id) 
{
	var rows = document.getElementsByTagName('tr');
	for ( var i = 0; i < rows.length; i++ ) 
	{
		tr = rows[i];
		if ( tr && tr.id==id)  
		{
			if(tr.style.display=='none') tr.style.display='table-row';
			else tr.style.display='none';
		}
	}
	return true;
}
function PopupWindow(url,width,height)
{
	var myBars = 'directories=no,location=yes,menubar=no,status=no,titlebar=no,toolbar=no'; 
	var myOptions = 'scrollbars=yes,width='+width+',height='+height+',resizeable=yes'; 
	var myFeatures = myBars + ',' + myOptions; 
	var wnd = open(url,'',myFeatures); 
}

function EffectWindow(url)
{
	window.onload = Shadowbox.init;	
}

function PrintWindow(id,width,height)
{
	var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no'; 
	var myOptions = 'scrollbars=yes,width='+width+',height='+height+',resizeable=yes'; 
	var myFeatures = myBars + ',' + myOptions; 
	var wnd = open('','',myFeatures);
	wnd.document.write('<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;  charset=utf-8" />\n<title>საბეჭდი ვერსია</title>\n</head>\n<body>\n');
	
	wnd.document.write(document.getElementById(id).innerHTML);
	
	wnd.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">\n<tr>\n<td align="right" valign="middle">\n<label>\n<img style="cursor:pointer" src="images/print_32.png"  hspace="5" title="ბეჭდვა"  onclick="window.print();"/>\n</label>\n</td>\n</tr>\n</table>\n</body>\n</html>');
}
function SendToFriendWindow(id,width,height)
{
	var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no'; 
	var myOptions = 'scrollbars=yes,width='+width+',height='+height+',resizeable=yes'; 
	var myFeatures = myBars + ',' + myOptions; 
	var wnd = open('','',myFeatures);	
	wnd.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>გაუგზავნე მეგობარს</title><style type="text/css">body,td,th {font-size: 12px; color: #000000;}</style></head><body><form name="form1" method="post" action="modules/sendtofriend/index.php">  მეგობრის ელ. ფოსტა<br><label><input type="text" name="toemail" id="toemail"></label><br>კომენტარი<br><label><textarea name="comment" id="comment" cols="35" rows="5"></textarea></label><br><br><label><input type="submit" name="button" id="button" value="გაგზავნა"></label><label><input type="reset" name="button2" id="button2" value="ფორმის გასუფთავება"><input type="hidden" name="message" id="message" value=""></label></form></body></html>');
	wnd.document.getElementById("message").value=document.getElementById(id).innerHTML;
}
function show_player(filename)
{
	var width=300;
	var height=220;
	document.write("<embed name='player' type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' width='"+width+"' height='"+height+"' showcontrols='true' autostart='false' src='"+filename+"'></embed>");
}
function show_player2(filename)
{
	var width=540;
	var height=380;
	document.write("<embed name='player' type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' width='"+width+"' height='"+height+"' showcontrols='true' autostart='false' src='"+filename+"'></embed>");
}
function playerWindow(filename)
{
	var width=300;
	var height=220;
	
	var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no'; 
	var myOptions = 'scrollbars=yes,width=819,height=610,resizeable=yes'; 
	var myFeatures = myBars + ',' + myOptions; 
	var wnd = open('','',myFeatures);
	wnd.document.write("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>ვიდეო რგოლი</title><style type='text/css'><!-- body,td,th {	font-size: 12px;} body { background-color: #000000; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --></style></head><body><embed name='player' type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' width='800' height='600' showcontrols='true' autostart='true' src='"+filename+"'></embed></body></html>");
}
function setHome()
{
   document.body.style.behavior='url(#default#homepage)';
   document.body.setHomePage(window.location.href);
}


