function pokaz(i, j, what){
	for (b=0;b<=j;b++){
		document.getElementById("star." + what + "." + i + "." + b).src = "Images/star_orange.gif";
	}
}

function hide(i, j, how, what, userrate){

	for (b=0;b<how;b++){
		v = "";
		if (userrate>b){
			v = "_";
		}
		document.getElementById("star." + what + "." + i + "." + b).src = "Images/star_purple" + v + ".gif";
	}
	for (b=how; b<5; b++){
		v = "";
		if (userrate>b){
			v = "_";
		}
		document.getElementById("star." + what + "." + i + "." + b).src = "Images/star_black" + v + ".gif";
	}
}
function getMovie() {
        var M$ =  navigator.appName.indexOf("Microsoft")!=-1
        return (M$ ? window : document)["BridgeMovie"]
}

function tomax(porid){
	document.getElementById("ba" + porid).style.display = 'block';
	document.getElementById("ba" + porid).style.height = m + "px";
	if (m>=80){
		document.getElementById("ba" + porid).style.height = "80px";
		clearInterval(myintmax);
	}
	m+=10;
}

function tomin(porid){
	document.getElementById('container' + porid).style.display = 'none';
	document.getElementById("ba" + porid).style.height = v + "px";;
	if (v<=0){
	document.getElementById("ba" + porid).style.display = 'none';
		clearInterval(myintmin);
	}
	v-=10;
}





function swfdown(porid, userid){
	top.location = 'http://infopir.com/get.php?id=' + porid;
}




var last = 0;
var lastpl=0;
function swfplay(porid, userid){

	if (lastpl){
		document.getElementById("pl[" + lastpl + "]").innerHTML = '';
		document.getElementById("pl[" + lastpl + "]").style.display = 'none';
	}
	lastpl = porid;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }

	if (req){
		req.onreadystatechange = function(){
			if (req.readyState == 4){
				if (req.status == 200){
					var mass = req.responseText.split(",");
					reklama_src = mass[0];
					reklama_image = mass[1];
					episod_src = mass[2];

					var types = episod_src.split(".");
					var type = types[1];

					if (type=="flv"){
						document.getElementById('filter').style.display = 'block';
						document.getElementById('box').style.display    = 'block';
						s1.addParam("flashvars","file=http://mediabomba.com.ua/streams/" + episod_src + "&streamer=lighttpd&fullscreen=true&skin=overlay.swf&autostart=true&frontcolor=ffffff&lightcolor=cc9900&controlbar=over&stretching=fill&plugins=googlytics-1");
						s1.write('boxcontent');
					} else {
						document.getElementById("pl[" + porid + "]").style.display = 'block';
						s2.addParam("flashvars","file=http://mediabomba.com.ua/streams/" + episod_src + "&autostart=true&skin=overlay.swf&plugins=googlytics-1");
						//s2.write('bottombar');

						s2.write("pl[" + porid + "]");
					}

				}
			}
		}
            req.open("GET", "reklama.php?id=" + porid + "&userid=" + userid, true);
            req.send("");
    }
}

var last = 0;
var lastpl=0;
function swfplay_embed(porid, userid){

	if (lastpl){
		document.getElementById("pl[" + lastpl + "]").innerHTML = '';
		document.getElementById("pl[" + lastpl + "]").style.display = 'none';
	}
	lastpl = porid;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        try {
    		req = new ActiveXObject("Msxml2.XMLHTTP");
  		}
  		catch (e) {
      		req = new ActiveXObject("Microsoft.XMLHTTP");
    	}
    }

	if (req){
		req.onreadystatechange = function(){
			if (req.readyState == 4){
				if (req.status == 200){
					var mass = req.responseText.split(",");
					reklama_src = mass[0];
					reklama_image = mass[1];
					episod_src = mass[2];

					var types = episod_src.split(".");
					var type = types[1];

					if (type=="flv"){
						document.getElementById('v_pl').style.display    = 'block';
						s1.addParam("flashvars","file=http://mediabomba.com.ua/streams/" + episod_src + "&streamer=lighttpd&fullscreen=true&skin=overlay.swf&autostart=false&frontcolor=ffffff&lightcolor=cc9900&controlbar=over&stretching=fill&plugins=googlytics-1");
						s1.write('v_pl');
					} else {
						document.getElementById("ply[" + porid + "]").style.display = 'block';
						s2.addParam("flashvars","file=http://mediabomba.com.ua/streams/" + episod_src + "&autostart=true&skin=overlay.swf&plugins=googlytics-1");
						s2.write("ply[" + porid + "]");
					}

				}
			}
		}
            req.open("GET", "reklama.php?id=" + porid + "&userid=" + userid, true);
            req.send("");
    }
}


function swfplaylist(porid, userid){
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
	if (req){
		req.onreadystatechange = function(){
			if (req.readyState == 4){
				if (req.status == 200){
					var mass = req.responseText.split(",");
					reklama_src = mass[0];
					reklama_image = mass[1];
					episod_src = mass[2];rekal
					var hq_src = '';
					var thumb = '';
					var file = episod_src.split(".");
					var type = file[1];
					if (type == 'flv'){
						hq_src = "&MediaLink2=http://mediabomba.com.ua/streams/" + file[0] + ".mp4";
						thumb = "&image=http://mediabomba.com.ua/streams/thumbnails/" + file[0] + ".jpg";
					}

					si_new_player=new SWFObject("player.swf","ply","608","342","9","#000000");
					si_new_player.addParam("allowfullscreen","true");
					si_new_player.addParam("allowscriptaccess","always");
					si_new_player.addParam("autoStart","true");
					
					si_new_player.addParam('flashvars', 'rek=' + reklama_src + '&cont=http://mediabomba.com.ua/streams/' + episod_src + hq_src + thumb + '&idm=' + porid);
					si_new_player.write('playlist');
				}
			}
		}
            req.open("GET", "reklama.php?id=" + porid + "&userid=" + userid, true);
            req.send("");
    }
}


function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function movebottombar() {
	bb = document.getElementById('bottombar');
	b2 = document.getElementById('topbar');

	if (window.innerHeight) {
		bb.style.top = (window.innerHeight - 20) + "px";
	} else {
		bb.style.top = (getH() + document.body.scrollTop - 20) + "px";
		bb.style.width = (document.documentElement.clientWidth - h) + "px";
		b2.style.width = (document.documentElement.clientWidth - h) + "px";
	}
}


function sss(){
	var f = getCookie("finish");
	if (f=="ok"){
		next();
		setCookie("finish", "0");
	}
}
function prev(){

	if (eto>0){
		eto--;
		swfplaylist(allids[eto], sid);
		icon(allids[eto]);
	}
}
function next(){

	if (eto<max-1){
		eto++;
		swfplaylist(allids[eto], sid);
		icon(allids[eto]);
	}
}
function icon(id){
	for (i = 0; i<max; i++){
		document.getElementById("p" + allids[i]).src = "Images/play.gif";
	}
	document.getElementById("p" + id).src = "Images/play2.gif";
}

function playthis(){
	swfplaylist(allids[eto], sid);
	icon(allids[eto]);
}
cc = 0;
function resize(){


	document.getElementById('box').style.left = ((getW()-480)/2) + "px";
	if (window.innerHeight) {
		document.getElementById('box').style.top = (((getH()-363)/2) + scrollY) + "px";
		document.getElementById('filter').style.width = getW() + "px";
		document.getElementById('filter').style.height = getH() + "px";
		document.getElementById('filter').style.top = scrollY + "px";
	} else {
		document.getElementById('box').style.top = (((getH()-363)/2) + document.body.scrollTop) + "px";
		document.getElementById('filter').style.width = getW() + "px";
		document.getElementById('filter').style.height = getH() + "px";
		document.getElementById('filter').style.top = document.body.scrollTop + "px";
	}


	//document.getElementById('box').style.width = 400 + "px";
	//document.getElementById('box').style.height = 323 + "px";

}

function getW(){
	var w;
	if (document.innerWidth){
		w=document.innerWidth;
	} else if (document.documentElement.clientWidth){
		w=document.documentElement.clientWidth;
	} else if (document.body){
		w=document.body.clientWidth;
	}
	return w;
}

function getH(){
	var h;
	if (document.innerHeight){
		h=document.innerHeight;
	} else if (document.documentElement.clientHeight){
		h=document.documentElement.clientHeight;
	} else if (document.body){
		h=document.body.clientHeight;
	}
	return h;
}


function cou(how){

	document.getElementById('ost').innerHTML = how - document.getElementById('description').value.length;
	if (document.getElementById('description').value.length>how){
		document.getElementById('description').value = document.getElementById('description').value.substring(0, how-1);
	}
}