
/* 	***************************************************************************
	IMPRESSUM
	*************************************************************************** */
	function impresspopup(){
		winpops=window.open("http://www.emimusic.de/cgi-bin/electrola-net/impressum_full.cgi?bgcolor=FFFFFF&fontcolor=666666&reply=info-emi@emimusic.de","impressum","width=500,height=450,dependent=yes, scrollbars=yes, menubar=no, resizable=no,left=100;top=100;");
	}
	
/* 	***************************************************************************
	GALERIE POPUP
	*************************************************************************** */	

	function pictureviewer(URL) {
		window.open(URL ,"galerie"," width=580, height=590, directories=no, location=no, menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no");
	}	
	
/* 	***************************************************************************
	NEWSLETTER POPUP
	*************************************************************************** */	

	function newsletter(URL) {
		window.open(URL ,"newsletter"," width=800, height=600, directories=no, location=no, menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no");
	}
	
/* 	***************************************************************************
	TRACKING FUER GOOGLE ANALYTICS
	*************************************************************************** */
	/* _uacct = "UA-375666-1"; // Im Footer eingebaut! */
	/* urchinTracker(); // aufruf spŠter freischalten */
	
	
/* 	***************************************************************************
	EMI RATING
	*************************************************************************** */

	var onLoadFunctionList = new Array();
	function performOnLoadFunctions(){
		for (var i in onLoadFunctionList){
			onLoadFunctionList[i]();
		}
	}
	
	function replaceDivContents(xmlHttpRequest, dstDivId){
		var dstDiv = document.getElementById(dstDivId);
		dstDiv.innerHTML = xmlHttpRequest.responseText;
	}
		
	var UT_RATING_IMG = abs_path + 'img_style/icon_ratingstar_full.gif';
	var UT_RATING_IMG_HOVER = abs_path + 'img_style/icon_ratingstar_full.gif';
	var UT_RATING_IMG_HALF = abs_path + 'img_style/icon_ratingstar_half.gif';
	var UT_RATING_IMG_BG = abs_path + 'img_style/icon_ratingstar_empty.gif';
	var UT_RATING_IMG_REMOVED = abs_path + 'img_style/icon_ratingstar_empty.gif';
	
	function EMIRating(ratingElementId, maxStars, objectName, formName, ratingMessageId, componentSuffix, messages, asset)
	{
		this.constructor = EMIRating;
		this.ratingElementId = ratingElementId;
		this.maxStars = maxStars;
		this.objectName = objectName;
		this.formName = formName;
		this.ratingMessageId = ratingMessageId;
		this.componentSuffix = componentSuffix;
		this.messages = messages;
		this.asset = asset;
		this.messages = [this.asset+" bewerten:", "Erb&auml;rmlich", "Nichts besonderes", "Empfehlenswert", "Super!", "Gro&szlig;artig!!!"];
	
		this.starTimer = null;
		this.starCount = 0;
	
		// pre-fetch image
		(new Image()).src = UT_RATING_IMG;
		(new Image()).src = UT_RATING_IMG_HALF;
	
		function showStars(starNum, skipMessageUpdate) {
			this.clearStarTimer();
			this.greyStars();
			this.colorStars(starNum);
			if(!skipMessageUpdate)
				this.setMessage(starNum, messages);
		}
	
		function setMessage(starNum) {
			document.getElementById(this.ratingMessageId).innerHTML = this.messages[starNum];
		}

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

		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;
				}
				else
				{
					document.getElementById('star_' + this.componentSuffix + "_"  + (i+1)).src = UT_RATING_IMG_BG;
				}
		}

		function setStars(starNum, contentId) {
			this.starCount = starNum;
			this.drawStars(starNum);
			addAjaxReqest(abs_path+'include/functions/wsdl_data.php?func=rateContent&starNum='+starNum+'&contentId='+contentId+'' ,'rateContent');
		}


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

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

		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;
			}
		}
	
		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;
	}
