/*
'=================================================================================
'
'    Designer's site Program 全站静态系统
'    xizon@c945.com
'    www.c945.com
'    技术支持：没位道
'    未经允许不得私自用于任何商业用途
'    产品官方网站：http://www.badpark.net   http://www.c945.com/d-s
'
'=================================================================================
*/
var MyrootPath;

//================================================
var http_request = false;
var moodIDNow;

function showMoodNum(id){
	$(document).ready(function(){    
		$.post( MyrootPath + 'admin/root_client_action/catvoteMood.asp?titleID='+id+'&t=good', function(data) {
		   $('#attitudeinfo0_'+id).html(data);
		});
		$.post( MyrootPath + 'admin/root_client_action/catvoteMood.asp?titleID='+id+'&t=bad', function(data) {
		   $('#attitudeinfo1_'+id).html(data);
		});
	 
	}) 
		
}

function makeRequest(url, functionName, httpType, sendData) {

	http_request = false;
	if (!httpType) httpType = "GET";

	if (window.XMLHttpRequest) { // Non-IE...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/plain');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Cannot send an XMLHTTP request');
		return false;
	}

	var changefunc="http_request.onreadystatechange = "+functionName;
	eval (changefunc);
	//http_request.onreadystatechange = alertContents;
	http_request.open(httpType, url, true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(sendData);
}
function $Vote() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}
//判断重复投票cookie和状态判断
function get_attitude(attitude_id,moodID)
{
		url = MyrootPath + "admin/root_client_action/catvoteMood.asp?action=attitude&titleID="+moodID+"&typee="+attitude_id+"&m=" + Math.random();
		makeRequest(url,'return_review1','GET','');
		
		if (attitude_id == "_good") {
		floatWin('温馨提示','<center><br /><br /><img src=' + MyrootPath + 'images/right.gif border=0/>&nbsp;^O^ 嗷，被您顶得真舒服，希望您下次再来哦！！</center>',430,120,170,0,1,0);}else{
	    floatWin('温馨提示','<center><br /><br /><img src=' + MyrootPath + 'images/right.gif border=0/>&nbsp;>_< 嗷，踩的我好疼，我一定再接再厉，下次不要踩我了呀！！</center>',430,120,170,0,1,0);
	}
	
	
	//输出
	$(document).ready(function(){    
		$.post( MyrootPath + 'admin/root_client_action/catvoteMood.asp?titleID='+moodID+'&t=good', function(data) {
		   $('#attitudeinfo0_'+moodID).html(data);
		});
		$.post( MyrootPath + 'admin/root_client_action/catvoteMood.asp?titleID='+moodID+'&t=bad', function(data) {
		   $('#attitudeinfo1_'+moodID).html(data);
		});
	 
	}) 




}

	
function return_review1(ajax)
{
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var str_error_num = http_request.responseText;
			if(str_error_num=="error")
			{
				floatWin('温馨提示','<center><br /><br /><img src=' + MyrootPath + 'images/error.gif border=0/>&nbsp;信息不存在！</center>',430,120,170,0,1,0);

			}
			else if(str_error_num==0)
			{
				//floatWin('温馨提示','<center><br /><br /><img src=' + MyrootPath + 'images/error.gif border=0/>&nbsp;^_^ 您太热心啦，请休息一下，别搞死我啦！！</center>',430,120,170,0,1,0);

			}
			else
			{
				attitudeinner(str_error_num);
			}
		} else {
			//页面未记载完执行

		}
	}
}


function attitudeinner(attitudetext)
{
	var color1 = "#666666";
	var color2 = "#EB610E";
	var heightz = "80";	//图片100%时的高
	var hmax = 0;
	var hmaxpx = 0;
	var heightarr = new Array();
	var attitudearr = attitudetext.split(",");
	var attitudezs = 0;
	for(k=0;k<2;k++) {
		attitudearr[k] = parseInt(attitudearr[k]);
		attitudezs += attitudearr[k];
	}
	for(i=0;i<2;i++) {
		heightarr[i]= Math.round(attitudearr[i]/attitudezs*heightz);
		if(heightarr[i]<1) heightarr[i]=1;
		if(attitudearr[i]>hmaxpx) {
		hmaxpx = attitudearr[i];
		}
	}

}