// JavaScript Document
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,title,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,title,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 v = new RegExp(); 
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 
    if (v.test(filename)) 
	{ 
        document.write('<object width="540" height="380"><param name="movie" value="'+filename+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+filename+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="380"></embed></object>');  
    }
	else
	{
		document.write('<div id="playerdiv"></div>');
		var so = new SWFObject("preview.swf", "main", "300", "220", "8", "#000000");
		so.addParam("allowFullScreen", "true");
		so.addVariable("MediaLink", filename);
		so.addVariable("defaultMedia", "1");
		so.addVariable("playOnStart", "true");
		so.addVariable("share", "false");
		so.write("playerdiv");
	}
}
function show_player2(filename)
{
	var v = new RegExp(); 
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 
    if (v.test(filename)) 
	{ 
        document.write('<object width="540" height="380"><param name="movie" value="'+filename+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+filename+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="380"></embed></object>');  
    }
	else
	{
		document.write('<div id="playerdiv"></div>');
		var so = new SWFObject("preview.swf", "main", "540", "380", "8", "#000000");
		so.addParam("allowFullScreen", "true");
		so.addVariable("MediaLink", filename);
		so.addVariable("defaultMedia", "1");
		so.addVariable("startVolume", "100");
		so.addVariable("playOnStart", "true");
		so.addVariable("share", "false");
		so.write("playerdiv");
	}
}
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);
}

