// AJAX ----------------------------------------



var xmlHttp



function GetXmlHttpObject(){



var xmlHttp = null;



	try {

	  // Firefox, Opera 8.0+, Safari

	  xmlHttp = new XMLHttpRequest();

	  }

	catch (e) {

	  // Internet Explorer

	  try {

			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");

		}

	  catch (e){

			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

		}

	  }

	  

	return xmlHttp;



}



// Calculate the rating

function rate(rating,id,show5,showPerc,showVotes){
	xmlHttp = GetXmlHttpObject()

	

	if(xmlHttp == null){

		alert ("Your browser does not support AJAX!");

		return;

	  }



	xmlHttp.onreadystatechange = function(){

		

	var loader = document.getElementById('loading');

	var uldiv = document.getElementById('current');

	

		if (xmlHttp.readyState == 4){ 

			

			//loader.style.display = 'none';

			var res = xmlHttp.responseText;
		
			if(res == 'already_voted'){

				loader.style.display = 'block';

				loader.innerHTML = '<div class="voted_twice">You have already voted!</div>';

				

			} else {

				

				loader.style.display = 'block';

				loader.innerHTML = 'Thanks for voting!';



				if(show5 == true){

					var out = document.getElementById('outOfTen');
					out.innerHTML = res;
				} 

				

				if(showPerc == false){

					var perc = document.getElementById('current');
					if(navigator.appName == 'Microsoft Internet Explorer'){
                    var newPerc = res*18;
					uldiv.style.setAttribute('width',+newPerc+'px'); // IE

				 } else {
                    var newPerc = res*18;
					uldiv.setAttribute('style','width:'+newPerc+'px'); // Everyone else

				 }

				}			

				if(showVotes == true){

					var votediv = document.getElementById('showvotes').firstChild.nodeValue;

					var splitted = votediv.split(' ');

					var newval = parseInt(splitted[0]) + 1;

					if(newval == 1){

						document.getElementById('showvotes').innerHTML = newval+' Vote';

					} else {

						document.getElementById('showvotes').innerHTML = newval+' Votes';

					}

				}

				

				var ulRater = document.getElementById('unit_ul');

				ulRater.className = 'unit-rating';

				

				var all_li = ulRater.getElementsByTagName('li');

				

				// start at 1 because the first li isn't a star

				for(var i=1;i<all_li.length;i++){

					

					all_li[i].getElementsByTagName('a')[0].onclick = 'return false;';

					all_li[i].getElementsByTagName('a')[0].setAttribute('href','#');

					

				}

				



				

			}

		} else {

			loader.innerHTML = 'wait please...';	

		}

	

	}


var  url = "../../add_rating.php";
var params = "id="+id+"&rating="+rating+"&sid="+Math.random();

	xmlHttp.open("POST",url,true);

	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send(params);

}
function showflash(H,_,L,I,N,O,C,P,A,G){var E=P==null?"0.0.0.0":P,B=new SWFObject(H,_,L,I,E,""),D="flashdiv_"+_;G=G==null?false:G;if(G)document.write("<div id=\""+_+"_flashLoading\" style=\"width="+L+";text-align=center\">Loading Game...Please Waiting...</div>");document.write("<div id='"+D+"'>loading</div>");if(P!=null){var F=P.toString().split("."),K,$="";for(K=0;K<4;K++)if(F[K]==null)F[K]=0;else F[K]=parseInt(F[K]);var M=new deconcept.PlayerVersion(F),J=B.installedVer.versionIsValid(M);if(!J){$+="<p></p>";$+="This is FLASH";$+="<br>Your not install flash player active x.";$+="<br><a href=\"http://www.adobe.com/go/BPCLF\" style=\"color:red\">click to install flash player active x.</a>";$+="<p></p>";getObject(D).innerHTML=$;return false}}C=C==null||C=="false"?"false":C;O=O==null||O=="false"?"false":O;A=A==null?"":A;N=N==null||N=="false"?"window":"transparent";B.addParam("menu",C);B.addParam("allowFullScreen",O);B.addParam("allowScriptAccess","always");B.addParam("flashVars",A);B.addParam("wmode",N);if(H.indexOf("http")!=-1)B.addParam("base",H);B.write(D);if(G)showLoadingProgress(_+"_flashLoading",_)}function showLoadingProgress(_,$){refreshProgress($,_)}function refreshProgress($,C){var B;B=document.getElementById($);if(!B){nTimeoutId=setTimeout("refreshProgress(\""+$+"\",\""+C+"\")",50);return}var A=Math.abs(B.PercentLoaded());if(A==100){try{clearTimeout(nTimeoutId)}catch(_){}getObject(C).style.display="none"}else{getObject(C).innerHTML="Loading Game...Please waiting..."+A+"%...";nTimeoutId=setTimeout("refreshProgress(\""+$+"\",\""+C+"\")",50)}}function getObject($){return document.getElementById($)}if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(B,D,E,C,A,_,G,I,J,$){if(!document.getElementById)return;this.DETECT_KEY=$?$:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(B)this.setAttribute("swf",B);if(D)this.setAttribute("id",D);if(E)this.setAttribute("width",E);if(C)this.setAttribute("height",C);if(A)this.setAttribute("version",new deconcept.PlayerVersion(A.toString().split(".")));this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7)deconcept.SWFObject.doPrepUnload=true;if(_)this.addParam("bgcolor",_);var F=G?G:"high";this.addParam("quality",F);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var H=(I)?I:window.location;this.setAttribute("xiRedirectUrl",H);this.setAttribute("redirectUrl","");if(J)this.setAttribute("redirectUrl",J)};deconcept.SWFObject.prototype={useExpressInstall:function($){this.xiSWFPath=!$?"expressinstall.swf":$;this.setAttribute("useExpressInstall",true)},setAttribute:function($,_){this.attributes[$]=_},getAttribute:function($){return this.attributes[$]},addParam:function($,_){this.params[$]=_},getParams:function(){return this.params},addVariable:function($,_){this.variables[$]=_},getVariable:function($){return this.variables[$]},getVariables:function(){return this.variables},getVariablePairs:function(){var $=new Array(),_,A=this.getVariables();for(_ in A)$[$.length]=_+"="+A[_];return $},getSWFHTML:function(){var $="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}$="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";$+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var A=this.getParams();for(var B in A)$+=[B]+"=\""+A[B]+"\" ";var _=this.getVariablePairs().join("&");if(_.length>0)$+="flashvars=\""+_+"\"";$+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}$="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";$+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";A=this.getParams();for(B in A)$+="<param name=\""+B+"\" value=\""+A[B]+"\" />";_=this.getVariablePairs().join("&");if(_.length>0)$+="<param name=\"flashvars\" value=\""+_+"\" />";$+="</object>"}return $},write:function($){if(this.getAttribute("useExpressInstall")){var A=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(A)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var _=(typeof $=="string")?document.getElementById($):$;_.innerHTML=this.getSWFHTML();return true}else if(this.getAttribute("redirectUrl")!="")document.location.replace(this.getAttribute("redirectUrl"));return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var B=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var C=navigator.plugins["Shockwave Flash"];if(C&&C.description)B=new deconcept.PlayerVersion(C.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var A=1,_=3;while(A){try{_++;A=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_);B=new deconcept.PlayerVersion([_,0,0])}catch($){A=null}}}else{try{A=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch($){try{A=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");B=new deconcept.PlayerVersion([6,0,21]);A.AllowScriptAccess="always"}catch($){if(B.major==6)return B}try{A=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch($){}}if(A!=null)B=new deconcept.PlayerVersion(A.GetVariable("$version").split(" ")[1].split(","))}return B};deconcept.PlayerVersion=function($){this.major=$[0]!=null?parseInt($[0]):0;this.minor=$[1]!=null?parseInt($[1]):0;this.rev=$[2]!=null?parseInt($[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function($){if(this.major<$.major)return false;if(this.major>$.major)return true;if(this.minor<$.minor)return false;if(this.minor>$.minor)return true;if(this.rev<$.rev)return false;return true};deconcept.util={getRequestParameter:function(_){var A=document.location.search||document.location.hash;if(_==null)return A;if(A){var $=A.substring(1).split("&");for(var B=0;B<$.length;B++)if($[B].substring(0,$[B].indexOf("="))==_)return $[B].substring(($[B].indexOf("=")+1))}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var $=document.getElementsByTagName("OBJECT");for(var A=$.length-1;A>=0;A--){$[A].style.display="none";for(var _ in $[A])if(typeof $[A][_]=="function")$[A][_]=function(){}}};if(deconcept.SWFObject.doPrepUnload)if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}if(!document.getElementById&&document.all)document.getElementById=function($){return document.all[$]};var getQueryParamValue=deconcept.util.getRequestParameter,FlashObject=deconcept.SWFObject,SWFObject=deconcept.SWFObject