﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		/*jQuery("#backgroundPopup").css({
			"opacity": "0.5"
		});*/
		jQuery("#backgroundPopup").fadeIn("fast");
		//document.getElementById("backgroundPopup").style.visibility='visible';
		div_popupContact = document.getElementById("popupContact");
		div_popupContact.style.zIndex = "1000";
		div_Mask = document.getElementById("backgroundPopup");
		div_Mask.style.zIndex = "999";
		div_Mask.style.position = "absolute";
		//div_Mask.style.backgroundColor = this.MaskColor?this.MaskColor:"#000000";
		div_Mask.style.backgroundColor = '#000000';
		div_Mask.style.width =  "100%";
		div_Mask.style.height =  "1000";
		div_Mask.style.top = "0px";
		div_Mask.style.left = "0px";
		div_Mask.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=40,finishOpacity=100,style=0)";
		div_Mask.style.opacity = 40/100;
		div_Mask.style.display = "block";
		jQuery("#popupContact").fadeIn("fast");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		jQuery("#backgroundPopup").fadeOut("fast");
		jQuery("#popupContact").fadeOut("fast");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact").height();
	var popupWidth = jQuery("#popupContact").width();
	//centering
	jQuery("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//alert(windowHeight/2-popupHeight/2);
	//alert(windowWidth/2-popupWidth/2);
	//only need force for IE6
	
	jQuery("#backgroundPopup").css({
		"height": windowHeight
		
	});
	//alert(widowHeight);
}
function showSucai()
{

document.advAction.submit();disablePopup();
}

		
	function addCookie(objName,objValue,objHours){//添加cookie
   var str = objName + "=" + escape(objValue);
   if(objHours > 0){//为0时不设定过期时间，浏览器关闭时cookie自动消失
    var date = new Date();
    var ms = objHours*3600*1000;
    date.setTime(date.getTime() + ms);
    str += "; expires=" + date.toGMTString();
   }
   document.cookie = str;
  // alert("添加cookie成功");
  }
  
  function getCookie(objName){//获取指定名称的cookie的值
   var arrStr = document.cookie.split("; ");
   for(var i = 0;i < arrStr.length;i ++){
    var temp = arrStr[i].split("=");
    if(temp[0] == objName) return unescape(temp[1]);
   } 
  }
  
  function delCookie(name){//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
   var date = new Date();
   date.setTime(date.getTime() - 10000);
   document.cookie = name + "=a; expires=" + date.toGMTString();
  }
  
  function allCookie(){//读取所有保存的cookie字符串
   var str = document.cookie;
   if(str == ""){
    str = "没有保存任何cookie";
   }
   //alert(str);
  }
  
  function timestamp() { 
     var timestamp = Date.parse(new Date()); 
     return timestamp; 
  } 

