﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

/***************************/
//@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;
var buttonId;
var backgroundId;
var popupId;
var closeId;




function setproductId1(btnId,bckId,pId,cId){

    buttonId=btnId;
    backgroundId=bckId;
    popupId=pId;
    closeId = cId;
    centerPopup1();
    loadPopup1();
}

function setProductValue1(pp,divp)
{
   var hidden=document.getElementById(pp);
   var value = hidden.value;
   var divproduct=document.getElementById(divp);
}



//loading popup with jQuery magic!
function loadPopup1(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$(backgroundId).css({
			"opacity": "0"
		});
		
		$(backgroundId).fadeIn("fast");
		$(popupId).fadeIn("fast");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup1(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$(backgroundId).fadeOut("fast");
		$(popupId).fadeOut("fast");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup1(){

	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	var popupHeight = $(popupId).height();
	var popupWidth = $(popupId).width();
	//alert("pheight :"+ popupHeight + ", pwidth" + popupWidth + ", top:" +windowHeight/2-popupHeight/2);
	//centering
	$(popupId).css({position: "fixed",width:"750px",top: windowHeight/2-popupHeight/2,left: (windowWidth/2)-(popupWidth/2)});
	//alert((popupHeight/2)+ "," +(windowHeight/2-popupHeight/2));
	//only need force for IE6
	
	$(backgroundId).css({height: windowHeight});
}

