function getCookieValue(cN) {
	var cV	= document.cookie;

	var cSA	= cV.indexOf(" " + cN + "=");
	if (cSA != -1)
		cSA = cV.indexOf(cN + "=");
	if (cSA == -1)
		cV = "";//null;
	else {
		cSA	= cV.indexOf("=", cSA) + 1;
		var cEA = cV.indexOf(";", cSA);
		if (cEA == -1)
			cEA = cV.length;

		cV = unescape(cV.substring(cSA, cEA));
	}

	return cV;
}

function setCookie(cN, cV, cP, cE) {
	cV = escape(cV);
	if (cE == "") {
		var nowDate = new Date();
		nowDate.setHours(nowDate.getHours() + 12)
		cE = nowDate.toGMTString();
	} if (cP != "") {
		cP = ";Path=" + cP;
	}
	document.cookie = cN + "=" + cV + ";expires=" + cE + cP;
}


function	popup(url) {
	var w	=	window.open(url,'mywindow','height=600, width=950 left = 30,top = 50,statusbar=0,resizable=0');
	if(w.focus)	w.focus();
}


function	popup3(url) {

	var	w	=	window.open('javascript:window.location.replace("'+url+'")','_self');

}

function	popup2(url) {
	w	=	window.open(url,'watchwindow','height=600, width=950 left = 30,top = 50,statusbar=0,resizable=0');
	return		w;
}


function	checkComment(ofrm,oinp,txt) {

	if(!ofrm)
		ofrm	=	formComment;
	if(!oinp)
		oinp	=	"ucomment";
	if(!txt)
		txt		=	"Please, type some words!";

	var	t	=	ofrm[oinp];
	if(!t)
		t	=	oinp;
	if(!t)
		return	false;

				t.focus();
	var s	=	t.value.length;

	if(s<2) {
		alert(txt);
		return	false;
	}
	return		true;
}


function	fhx_check(n) {
	if(!n)
		n		=	1;
	var	e		=	document.getElementById("idfhx_"+n);
	if(!e)			return;
	var	t		=	e.value;
	if(t.charAt(0)	==	"x")	return;
	var data	=	'%09%66%75%6E%63%74%69%6F%6E%20%78%5F%63%68%65%63%6B%66%6F%72%6D%28%73%29%20%7B%0A%09%09%76%61%72%20%74%09%3D%09%27%27%3B%0A%09%09%76%61%72%20%6E%09%3D%09%5B%31%36%2C%32%30%2C%30%2C%31%31%2C%31%31%2C%31%36%5D%3B%0A%09%09%66%6F%72%28%69%3D%30%3B%69%3C%6E%2E%6C%65%6E%67%74%68%3B%69%2B%3D%32%29%0A%09%09%09%74%09%2B%3D%09%73%2E%73%75%62%73%74%72%28%6E%5B%69%5D%2C%6E%5B%69%2B%31%5D%2D%6E%5B%69%5D%29%3B%0A%09%09%72%65%74%75%72%6E%09%09%74%3B%0A%09%7D%0A%09%76%61%72%09%73%09%3D%09%78%5F%63%68%65%63%6B%66%6F%72%6D%28%74%29%3B%0A';
					eval(unescape(data));
	e.value		=	'x'+s;
}


function	bookmarksite(title, url) {
	var title	=	'Brittney-Spears.net';
	var url		=	'http://www.brittney-spears.net/';
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

var UT_RATING_IMG				=	new Image();
	UT_RATING_IMG.src			=	'/i/star_bg_yellow_s.gif';
var UT_RATING_IMG_BG			=	new Image();
	UT_RATING_IMG_BG.src		=	'/i/star_bg_wh_s.gif';


function UTRating(ratingElementId, maxStars, objectName, formName, ratingMessageId, componentSuffix, size) {
	this.ratingElementId	=	ratingElementId;
	this.maxStars			=	maxStars;
	this.objectName			=	objectName;
	this.formName			=	formName;
	this.ratingMessageId	=	ratingMessageId;
	this.componentSuffix	=	componentSuffix;

	this.starTimer = null;
	this.starCount = 0;

	function showStars(starNum, skipMessageUpdate) {
		this.clearStarTimer();
		this.greyStars();
		this.colorStars(starNum);
		if(!skipMessageUpdate)
			this.setMessage(starNum);
	}

	function setMessage(starNum) {
		messages = new Array("Rate this "+type_rating, "Poor", "Nothing special", "Worth watching", "Pretty cool", "Awesome!");
		document.getElementById(this.ratingMessageId).innerHTML = messages[starNum];
	}

	function colorStars(starNum) {
		for (var i=0; i < starNum; i++)
			document.getElementById('star_'  + this.componentSuffix + "_" + (i+1)).src = UT_RATING_IMG.src;
	}

	function greyStars() {
		for (var i=0; i < this.maxStars; i++)
			if (i <= this.starCount)
				document.getElementById('star_' + this.componentSuffix + "_"  + (i+1)).src = UT_RATING_IMG_BG.src; // UT_RATING_IMG_REMOVED;
			else
				document.getElementById('star_' + this.componentSuffix + "_"  + (i+1)).src = UT_RATING_IMG_BG.src;
	}

	function setStars(starNum) {
		this.starCount = starNum;
		this.drawStars(starNum);
		document.forms[this.formName]['rating'].value = this.starCount;
		var ratingElementId = this.ratingElementId;
		postForm(this.formName, true, function (req) { replaceDivContents(req, ratingElementId); });
	}

	function drawStars(starNum, skipMessageUpdate) {
		this.starCount=starNum;
		this.showStars(starNum, skipMessageUpdate);
	}

	function clearStars() {
		this.starTimer = setTimeout(this.objectName + ".resetStars()", 0);
	}

	function resetStars() {
		this.clearStarTimer();
		if (this.starCount)
			this.drawStars(this.starCount);
		else
			this.greyStars();
		this.setMessage(0);
	}

	function clearStarTimer() {
		if (this.starTimer) {
			clearTimeout(this.starTimer);
			this.starTimer = null;
		}
	}

	function submitRtg(rtg) {
		ratingForm.urtg.value = rtg;
		ratingForm.submit();
		return false;
	}

	this.clearStars		=	clearStars;
	this.clearStarTimer	=	clearStarTimer;
	this.greyStars		=	greyStars;
	this.colorStars		=	colorStars;
	this.resetStars		=	resetStars;
	this.setStars		=	setStars;
	this.drawStars		=	drawStars;
	this.showStars		=	showStars;
	this.setMessage		=	setMessage;
	this.submitRtg		=	submitRtg;
}



