var zs_rater_visible = false;
	var zs_rater_rect = { left: 0, top: 0, width: 0, height: 0 };
	var zs_rater_origin;
	var zs_rater_action = "";
	var zs_rater_center_width = 432;

	function toggle_zs_rater(oCaller, oTitle, sAction) {
		var zs_rater = $g('zs_rater');
		var zs_rater_holder = $g('zs_rater_holder');
		var showVeil = false;

		if (!zs_rater_visible) {
			zs_rater_action = sAction;
			zs_rater_origin = getxy(oCaller);
			try {
				zs_rater_origin.x += Math.floor(oCaller.offsetWidth / 2);
				zs_rater_origin.y += Math.floor(oCaller.offsetHeight / 2);
			}
			catch (e) { }
			var stop = getscrolltop();
			var ww = getwindowsize();
			zs_rater_holder.style.left = "-9999px";
			zs_rater_holder.style.top = "0px";
			jQuery(zs_rater_holder).show();
			zs_rater_visible = true;
			if (zs_rater_center_width > 0 || zs_rater.clientHeight > ww.y)
				zs_rater_rect.top = Math.floor(stop.y + (ww.y - zs_rater.clientHeight) / 2);
			else {
				if ((zs_rater_origin.y + zs_rater.clientHeight) > (ww.y + stop.y))
					zs_rater_rect.top = (ww.y + stop.y - zs_rater.clientHeight - 10);
				else if (zs_rater_origin.y - Math.floor(zs_rater.clientHeight / 2) < stop.y)
					zs_rater_rect.top = stop.y + 10;
				else if (zs_rater_origin.y + Math.floor(2 * zs_rater.clientHeight / 3) > ( ww.y + stop.y ) )
					zs_rater_rect.top = ww.y + stop.y - zs_rater.clientHeight - 10;
				else
					zs_rater_rect.top = zs_rater_origin.y - Math.floor(zs_rater.clientHeight / 3);
			}
			if ( zs_rater_center_width > 0) {
				if ( zs_rater.clientWidth > ww.x )
					zs_rater_rect.left = 10;
				else
					zs_rater_rect.left = Math.floor(( ww.x - zs_rater.clientWidth) / 2);
			}
			else {
				if ((zs_rater_origin.x + zs_rater.clientWidth) > (ww.x + stop.x))
					zs_rater_rect.left = (ww.x + stop.x - zs_rater.clientWidth - 10);
				else if (zs_rater_origin.x - Math.floor(zs_rater.clientWidth / 2) < stop.x)
					zs_rater_rect.left = stop.x + 10;
				else
					zs_rater_rect.left = zs_rater_origin.x - Math.floor(zs_rater.clientWidth / 2);
			}
			zs_rater_rect.height = zs_rater.clientHeight;
			zs_rater_rect.width = zs_rater.clientWidth;
			zs_rater_holder.style.top = "" + zs_rater_rect.top + px;
			if (oTitle)
				jQuery('#zs_rater_label_text').text(oTitle);
			animate.open(zs_rater, function () {  zs_rater_opened(); zs_rater_holder.style.left = "" + zs_rater_rect.left + px; addShadow("zs_rater"); }, null, zs_rater_origin, zs_rater_rect);
			if ( showVeil && typeof show_veil == "function" ) {
				show_veil(1000 - 10);
			}
				
		}
		else {
			if ( showVeil && typeof hide_veil == "function" ) {
				hide_veil();
			}
			var currentPos = getxy(zs_rater_holder);
			zs_rater_rect.top = currentPos.y;
			zs_rater_rect.left = currentPos.x;
			zs_rater_holder.style.display = "none";
			animate.close(zs_rater, zs_rater_closed, null, zs_rater_origin, zs_rater_rect);
			zs_rater_visible = false;
		}
	}

	function  zs_rater_load_funct()
	{
		if ( typeof zs_rater_document_ready == "function" ) 
			zs_rater_document_ready();
	}

	function zs_rater_closed() {
		if (typeof zs_rater_onclose == "function" )
			zs_rater_onclose();
	}

	function zs_rater_opened() {
		if ( typeof zs_rater_onopen == "function" )
			zs_rater_onopen();
	}
	

	jQuery.noConflict();
	jQuery(document).ready( zs_rater_load_funct );


