/*move div start*/
	N = (document.all) ? 0 : 1;

	var obj_win;
	var x_v;
	var y_v;
	var obj_win_name = '';
	function MDC(e)
	{
	}

	function MD(e) 
	{
		if (N) 
		{
			if(obj_win_name != '')
			{
				obj_win = document.getElementById(obj_win_name);
				x_v = e.pageX - parseInt(obj_win.style.left);
				y_v = e.pageY - parseInt(obj_win.style.top);
				return false;
			}
		}
		else 
		{
			if(obj_win_name != '')
			{
				obj_win = document.getElementById(obj_win_name);
				x_v = event.clientX - parseInt(obj_win.style.left);
				y_v = event.clientY - parseInt(obj_win.style.top);
			}
	   	}
	}
	function MM(e) 
	{
		if (obj_win) 
		{
			if (N) 
			{
				obj_win.style.top = e.pageY - y_v;
				obj_win.style.left = e.pageX - x_v;
			}
			else 
			{
				obj_win.style.left = event.clientX + document.body.scrollLeft - x_v;
				obj_win.style.top = event.clientY + document.body.scrollTop - y_v;
				return false;
		  	}
	  	}
	}
	function MU() 
	{
		obj_win = null;
	}
	
	if (N) 
	{
		document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
	}
	document.onmousedown = MD;
	document.ondblclick = MDC;
	document.onmousemove = MM;
	document.onmouseup = MU;
/*move div end*/

/*loading picture show start*/
function getImage(pExistingImageID, pImageURL, max_width, max_height)
{
    var img = document.createElement('img');
	max_width = max_width - 60;
	max_height = max_height - 70;
	
    img.onload = function (evt) 
	{
        document.getElementById(pExistingImageID).src=this.src;
		
		var height = this.height;
		var width = this.width;
		var ratio = height/width;
	
		if(height > max_height)
		{
			ratio = max_height / height;
			height = height * ratio;
			width = width * ratio;
		}
	
		if(width > max_width)
		{
			ratio = max_width / width;
			height = height * ratio;
			width = width * ratio;
		}
	
        document.getElementById(pExistingImageID).width = width;
        document.getElementById(pExistingImageID).height = height;
        document.getElementById(pExistingImageID).style.width = width;
        document.getElementById(pExistingImageID).style.height = height;
    }
    img.src = pImageURL;
    return false;
}
var y = 0;
function show_image_fullscreen(i)
{
	var browser = navigator.appName;
	len = i.length;
	i = i.substr(0, len - 4) + 'b' + i.substr(len - 4);
	document.getElementById('tb_negru').style.height = "100%";
	document.getElementById('tb_negru').style.width = "100%";
	document.getElementById('tabel_peste').style.display = 'inline';
	document.getElementById('tabel_poza').style.display = 'inline';
	if(browser != "Microsoft Internet Explorer")
	{
		document.getElementById('tabel_poza').style.top = document.body.scrollTop + 0;
		document.getElementById('img_fulscreen').src = 'images/imag/loading.gif';
		value = 8;
		document.getElementById('tabel_peste').style.opacity = value/10;
		document.getElementById('tabel_peste').style.filter = 'alpha(opacity=' + value*10 + ')';
		getImage('img_fulscreen', i, window.innerWidth, window.innerHeight);
	}
	else
	{
		y = document.body.scrollTop;
		document.getElementById('img_fulscreen').src = 'images/imag/loading.gif';
		value = 8;
		document.getElementById('tabel_peste').style.opacity = value/10;
		document.getElementById('tabel_peste').style.filter = 'alpha(opacity=' + value*10 + ')';
		document.getElementById('tabel_poza').style.position = 'absolute';
		document.getElementById('tabel_principal').style.display = 'none';
		getImage('img_fulscreen', i, document.body.offsetWidth, document.body.offsetHeight);
	}
}
function hide_image_fullscreen()
{
	var browser = navigator.appName;
	i = 'images/imag/loading.gif';
	document.getElementById('tabel_peste').style.display = 'none';
	document.getElementById('tabel_poza').style.display = 'none';
	document.getElementById('img_fulscreen').src = i;
	document.getElementById('img_fulscreen').style.width = 32;
	document.getElementById('img_fulscreen').style.height = 32;
	if(browser == "Microsoft Internet Explorer")
	{
		
		document.getElementById('tabel_principal').style.display = 'inline';
		document.getElementById('tabel_poza').style.position = 'fixed';
		window.scrollTo(document.body.scrollLeft, y);
	}
}
function Key_Code_Work(e)
{
	key = e.keyCode;
	switch(key)
	{	
		case 27: 
				if (document.getElementById('img_fulscreen').src != 'images/imag/loading.gif')
				{
					hide_image_fullscreen();
				}
				break;
	}
}
/*loading picture show end*/

/*marquee vertical evenimetne start*/
/*
var delayb4scroll = 300;
var marqueespeed = 2;
var pauseit = 1;

var copyspeed = marqueespeed;
var pausespeed = (pauseit==0)? copyspeed: 0;
var contentheight = 0;

function scrollmarquee()
{	
	cross_marquee = document.getElementById("vmarquee");
	cross_marquee.style.top = parseInt(cross_marquee.style.top) - copyspeed + "px";
	if(-(parseInt(cross_marquee.style.top)-copyspeed) > contentheight)
	{
		cross_marquee.style.top = 0 ;
	}
}
function initializemarquee()
{
	cross_marquee = document.getElementById("vmarquee");
	cross_marquee.style.top = 0 + 'px';
	marqueeheight = document.getElementById("marqueecontainer").offsetHeight;
	contentheight = document.getElementById('contentmarquee').offsetHeight;
	cross_marquee.innerHTML = cross_marquee.innerHTML + cross_marquee.innerHTML;
	setTimeout('lefttime=setInterval("scrollmarquee()",300)', delayb4scroll);
}
function scrollmarqueepause()
{
	copyspeed = pausespeed;
}
function scrollmarqueeplay()
{
	copyspeed=marqueespeed;
}

if (window.addEventListener)
{
	window.addEventListener("load", initializemarquee, false);
}
else if (window.attachEvent)
{
	window.attachEvent("onload", initializemarquee);
}
else if (document.getElementById)
{
	window.onload=initializemarquee;
}

/*marquee vertical evenimetne end*/
/*cot start*/
function vot(i, j)
{
	for(k = 0; k <= i; k ++)
	{
		document.getElementById('pp_'+k+'_'+j).src = 'images/staron.jpg';
	}
	for(; k < 5; k ++)
	{
		document.getElementById('pp_'+k+'_'+j).src = 'images/staroff.jpg';											
	}
}
function vot_exec(i, j)
{
	document.getElementById('pnota_'+j).innerHTML = '<img src="images/ajax-loader.gif" />';
	url = 'exec.php?local=vot&v=' + i + '&p=' + j;
	url += "&sid=" + Math.random();
	if (url.substring(0, 4) != 'http') 
	{
		xend = document.location.href.lastIndexOf("/") + 1;
		var base_url = document.location.href.substring(0, xend);
		url = base_url + url ;
	}
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 	{
			document.getElementById('pnota_'+j).innerHTML = xmlHttp.responseText;
     	}
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function GetXmlHttpObject()
{
	var objXMLHttp=null;

	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
    }
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    return objXMLHttp;
}
/*vot end*/
/*ajax start*/
var dest = '';

function apel(destinatie, url)
{
	document.getElementById(destinatie).innerHTML = '<img src="images/ajax-loader.gif" style="padding:50"/>';
	url = 'exec.php?local='+destinatie+'&'+url;
	if (url.substring(0, 4) != 'http') 
	{
		xend = document.location.href.lastIndexOf("/") + 1;
		var base_url = document.location.href.substring(0, xend);
		url = base_url + url ;
	}
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 	{
			document.getElementById(destinatie).innerHTML = xmlHttp.responseText;
     	}
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}
/*ajax end*/

/*ajax online start*/
function online_exec(destinatie)
{
	document.getElementById(destinatie).src = 'images/ajax-loader.gif';
	url = 'exec.php?local=online';

	if (url.substring(0, 4) != 'http') 
	{
		xend = document.location.href.lastIndexOf("/") + 1;
		var base_url = document.location.href.substring(0, xend);
		url = base_url + url ;
	}
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 	{
			document.getElementById(destinatie).src = xmlHttp.responseText;
     	}
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}
/*ajax online end*/
