﻿/***************************/
//@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){
  $("#backgroundPopup").css({
   "opacity": "0.7"
  });
  $("#backgroundPopup").fadeIn("slow");
  $("#"+arguments[0]).fadeIn("slow");
  popupStatus = 1;
 }
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#"+arguments[0]).fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
 //request data for centering
 var windowWidth = document.documentElement.clientWidth;
 var windowHeight = document.documentElement.clientHeight;
 
 var popupHeight = $("#"+arguments[0]).height();
 var popupWidth = $("#"+arguments[0]).width();
 
    
 //centering
 $("#"+arguments[0]).css({
  "position": "absolute",
  "top": windowHeight/2-popupHeight/2,
  "left": windowWidth/2-popupWidth/2,
  "center": 1
 });
 //only need force for IE6
 
 $("#backgroundPopup").css({
  "height": windowHeight
 });
 
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function() {
	changeDiv = function(){
		world =
		'<table align="\center\" width=\"239\" cellspacing=\"0\" cellpadding=\"0\">'+
                           '<tr><td align=\"right\" valign=\"top\" class=\"find_box\"><img src=\"img/find.jpg\"></td>'+
                               '<td valign=\"top\" class=\"find_title\">'+
                                		'<strong><? php echo translate(\'Index Box 08 Find\')?></strong> <br /><?php echo translate(\'Index Box 09 Click\')?></td>'+
                                '<td><img src=\"img/spacer.png\" width=\"35\" height=\"1\"></td></tr></table>'+
		'<ul>'+
		'<li id=\"europe\"><a href=\"javascript:void(0);\">Europe</a></li>'+
		'<li id=\"asia\"><a href=\"javascript:void(0);\">Asia</a></li>'+
		'<li id=\"n-america\"><a href=\"javascript:void(0);\">North America</a></li>'+
		'<li id=\"mexico\"><a href=\"javascript:void(0);\">Mexico</a></li>'+
		'<li id=\"s-america\"><a href=\"javascript:void(0);\">South America</a></li>'+
		'<li id=\"africa\"><a href=\"javascript:void(0);\">Africa</a></li>'+
		'<li id=\"medioriente\"><a href=\"javascript:void(0);\">Medioriente</a></li>'+
		'</ul>';
		document.getElementById("map").innerHTML = world;

		$("#asia").click(function(){
			//centering with css
			centerPopup("schedaAsia");
			//load popup
			loadPopup("schedaAsia");
		});
		$("#africa").click(function(){
			//centering with css
			centerPopup("schedaAfrica");
			//load popup
			loadPopup("schedaAfrica");
		});
		$("#n-america").click(function(){
			//centering with css
			centerPopup("schedaNa");
			//load popup
			loadPopup("schedaNa");
		});
		
		$("#europe").click(function(){
			document.getElementById("map").innerHTML = '<div id=\"europeMap\">'+
			'<div id=\"worldback\"><a href=\"javascript:void(0)\" onclick=\"changeDiv()\" style=\"position:relative;\"><img src=\"img/enter_button_l.png\" border=\"0\" width=\"21\" height=\"20\"></a></div>' +
			'<ul>'+
			'<li id=\"austria\"><a href=\"javascript:void(0)\" onclick=\"loadPopup(\'schedaAu\');centerPopup(\'schedaAu\'); return false;\">Austria Switzerland Germany</a></li>'+
			'<li id=\"portugal\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaPt\');centerPopup(\'schedaPt\'); return false;\">Portugal</a></li>'+
			'<li id=\"france\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaFr\');centerPopup(\'schedaFr\'); return false;\">France</a></li>' +
			'<li id=\"est\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaEst\');centerPopup(\'schedaEst\'); return false;\">Europe</a></li>' +
			'<li id=\"spain\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaSp\');centerPopup(\'schedaSp\'); return false;\">Spain</a></li>' +
			'<li id=\"belgium\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaBe\');centerPopup(\'schedaBe\'); return false;\">Belgium Netherland Norway Sweden Denmark Finnland</a></li>'+
			'<li id=\"uk\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaUk\');centerPopup(\'schedaUk\'); return false;\">United Kingdom</a></li>'+
			'<li id=\"italy\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaIt\');centerPopup(\'schedaIt\'); return false;\">Italy</a></li>' +
			'</ul></div>';
		});
		
		$("#s-america").click(function(){
			document.getElementById("map").innerHTML = '<div id=\"s-americaMap\">'+
			'<div id=\"worldback\"><a href=\"javascript:void(0)\" onclick=\"changeDiv()\" style=\"position:relative\"><img src=\"img/enter_button_l.png\" border=\"0\" width=\"21\" height=\"20\"></a></div>'+
			'<ul>'+
			'<li id=\"colombia\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaCo\');centerPopup(\'schedaCo\'); return false;\">Colombia</a></li>'+
			'<li id=\"peru\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaPe\');centerPopup(\'schedaPe\'); return false;\">Perù</a></li>'+
			'<li id=\"venezuela\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaVe\');centerPopup(\'schedaVe\'); return false;\">Venezuela</a></li>'+
			'<li id=\"brasile\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaBr\');centerPopup(\'schedaBr\'); return false;\">Brasile</a></li>'+
			'<li id=\"argentina\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaAr\');centerPopup(\'schedaAr\'); return false;\">Argentina</a></li>'+
			'<li id=\"chile\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaChi\');centerPopup(\'schedaChi\'); return false;\">Chile</a></li>'+
			'</ul></div>';
		});
		
		$("#medioriente").click(function(){
			//centering with css
			centerPopup("schedaMo");
			//load popup
			loadPopup("schedaMo");
		});
		$("#mexico").click(function(){
			//centering with css
			centerPopup("schedaMx");
			//load popup
			loadPopup("schedaMx");
		});
		
		
		
		//CLOSING POPUP ASIA
		//Click the x event!
		$("#CloseAsia").click(function(){
			disablePopup("schedaAsia");
		});
		//CLOSING POPUP AFRICA
		//Click the x event!
		$("#CloseAfrica").click(function(){
			disablePopup("schedaAfrica");
		});
		//CLOSING POPUP NORTH AMERICA
		//Click the x event!
		$("#CloseNa").click(function(){
			disablePopup("schedaNa");
		});
		//CLOSING POPUP MEDIORIENTE
		//Click the x event!
		$("#CloseMo").click(function(){
			disablePopup("schedaMo");
		});
		//CLOSING POPUP MEXICO
		//Click the x event!
		$("#CloseMx").click(function(){
			disablePopup("schedaMx");
		});


		//CLOSING EUROPE STATES
		$("#CloseBe").click(function(){
			disablePopup("schedaBe");
		});
		$("#CloseSp").click(function(){
			disablePopup("schedaSp");
		});
		$("#CloseAu").click(function(){
			disablePopup("schedaAu");
		});
		$("#CloseEst").click(function(){
			disablePopup("schedaEst");
		});
		$("#ClosePt").click(function(){
			disablePopup("schedaPt");
		});
		$("#CloseFr").click(function(){
			disablePopup("schedaFr");
		});
		$("#CloseUk").click(function(){
			disablePopup("schedaUk");
		});
		$("#CloseIt").click(function(){
			disablePopup("schedaIt");
		});


		//CLOSING SOUTH AMERICA STATES
		$("#CloseCo").click(function(){
			disablePopup("schedaCo");
		});
		$("#ClosePe").click(function(){
			disablePopup("schedaPe");
		});
		$("#CloseVe").click(function(){
			disablePopup("schedaVe");
		});
		$("#CloseBr").click(function(){
			disablePopup("schedaBr");
		});
		$("#CloseAr").click(function(){
			disablePopup("schedaAr");
		});
		$("#CloseChi").click(function(){
			disablePopup("schedaChi");
		});

		//CLOSING BACKGROUND
		//Click out event!
		$("#backgroundPopup").click(function(){
			return;
		/*	disablePopup("schedaAsia");
			disablePopup("schedaNa");
			disablePopup("schedaSa");
			disablePopup("schedaMo");
			disablePopup("schedaMx");
			
			disablePopup("schedaIt");
			disablePopup("schedaSp");
			disablePopup("schedaAu");
			disablePopup("schedaEst");
			disablePopup("schedaBe");
			disablePopup("schedaUk");
			disablePopup("schedaPt");
			disablePopup("schedaFr");
			
			disablePopup("schedaCo");
			disablePopup("schedaPe");
			disablePopup("schedaVe");
			disablePopup("schedaBr");
		*/
		});



	}
	
	
	//LOADING POPUP ASIA
	//Click the button event!
	$("#asia").click(function(){
		//centering with css
		centerPopup("schedaAsia");
		//load popup
		loadPopup("schedaAsia");
	});
	
	//LOADING POPUP AFRICA
	//Click the button event!
	$("#africa").click(function(){
		//centering with css
		centerPopup("schedaAfrica");
		//load popup
		loadPopup("schedaAfrica");
	});
	
	//LOADING POPUP NORTH AMERICA
	//Click the button event!
	$("#n-america").click(function(){
		//centering with css
		centerPopup("schedaNa");
		//load popup
		loadPopup("schedaNa");
	});
	
	//LOADING POPUP EUROPE
	//Click the button event!
	$("#europe").click(function(){
		document.getElementById("map").innerHTML ='<div id=\"europeMap\">'+
			'<div id=\"worldback\"><a href=\"javascript:void(0)\" onclick=\"changeDiv()\" style=\"position:relative;\"><img src=\"img/enter_button_l.png\" border=\"0\" width=\"21\" height=\"20\"></a></div>' +				
			'<ul>'+
					'<li id=\"austria\"><a href=\"javascript:void(0)\" onclick=\"loadPopup(\'schedaAu\');centerPopup(\'schedaAu\'); return false;\">Austria Switzerland Germany</a></li>'+
					'<li id=\"portugal\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaPt\');centerPopup(\'schedaPt\'); return false;\">Portugal</a></li>'+
                    '<li id=\"france\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaFr\');centerPopup(\'schedaFr\'); return false;\">France</a></li>' +
					'<li id=\"est\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaEst\');centerPopup(\'schedaEst\'); return false;\">Europe</a></li>' +
                    '<li id=\"spain\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaSp\');centerPopup(\'schedaSp\'); return false;\">Spain</a></li>' +
                    '<li id=\"belgium\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaBe\');centerPopup(\'schedaBe\'); return false;\">Belgium Netherland Norway Sweden Denmark Finnland</a></li>'+
					'<li id=\"uk\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaUk\');centerPopup(\'schedaUk\'); return false;\">United Kingdom</a></li>'+
					'<li id=\"italy\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaIt\');centerPopup(\'schedaIt\'); return false;\">Italy</a></li>' +
                 '</ul></div>';
	});

	//LOADING POPUP SOUTH AMERICA
	//Click the button event!
	$("#s-america").click(function(){
		document.getElementById("map").innerHTML =  '<div id=\"s-americaMap\">'+
			'<div id=\"worldback\"><a href=\"javascript:void(0)\" onclick=\"changeDiv()\" style=\"position:relative;\"><img src=\"img/enter_button_l.png\" border=\"0\" width=\"21\" height=\"20\"></a></div>'+
				'<ul>'+
				   '<li id=\"colombia\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaCo\');centerPopup(\'schedaCo\'); return false;\">Colombia</a></li>'+
				   '<li id=\"peru\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaPe\');centerPopup(\'schedaPe\'); return false;\">Perù</a></li>'+
				   '<li id=\"venezuela\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaVe\');centerPopup(\'schedaVe\'); return false;\">Venezuela</a></li>'+
				   '<li id=\"brasile\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaBr\');centerPopup(\'schedaBr\'); return false;\">Brasile</a></li>'+
				   '<li id=\"argentina\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaAr\');centerPopup(\'schedaAr\'); return false;\">Argentina</a></li>'+
				   '<li id=\"chile\"><a href=\"javascript: void(0)\" onclick=\"loadPopup(\'schedaChi\');centerPopup(\'schedaChi\'); return false;\">Chile</a></li>'+
                 '</ul></div>';
	});
	
	//LOADING POPUP MEDIORIENTE
	//Click the button event!
	$("#medioriente").click(function(){
		//centering with css
		centerPopup("schedaMo");
		//load popup
		loadPopup("schedaMo");
	});
	
	//LOADING POPUP MEXICO
	//Click the button event!
	$("#mexico").click(function(){
		//centering with css
		centerPopup("schedaMx");
		//load popup
		loadPopup("schedaMx");
	});
								
				
	//CLOSING POPUP ASIA
	//Click the x event!
	$("#CloseAsia").click(function(){
		disablePopup("schedaAsia");
	});
	
	//CLOSING POPUP AFRICA
	//Click the x event!
	$("#CloseAfrica").click(function(){
		disablePopup("schedaAfrica");
	});
	
	//CLOSING POPUP NORTH AMERICA
	//Click the x event!
	$("#CloseNa").click(function(){
		disablePopup("schedaNa");
	});
	
	//CLOSING POPUP MEDIORIENTE
	//Click the x event!
	$("#CloseMo").click(function(){
		disablePopup("schedaMo");
	});
	
	//CLOSING POPUP MEXICO
	//Click the x event!
	$("#CloseMx").click(function(){
		disablePopup("schedaMx");
	});
	
	
	//CLOSING EUROPE STATES
	$("#CloseBe").click(function(){
		disablePopup("schedaBe");
	});	
	$("#CloseSp").click(function(){
		disablePopup("schedaSp");
	});
	$("#CloseAu").click(function(){
		disablePopup("schedaAu");
	});
	$("#CloseEst").click(function(){
		disablePopup("schedaEst");
	});
	$("#ClosePt").click(function(){
		disablePopup("schedaPt");
	});
	$("#CloseFr").click(function(){
		disablePopup("schedaFr");
	});
	$("#CloseUk").click(function(){
		disablePopup("schedaUk");
	});
	$("#CloseIt").click(function(){
		disablePopup("schedaIt");
	});
	
	
	//CLOSING SOUTH AMERICA STATES
	$("#CloseCo").click(function(){
		disablePopup("schedaCo");
	});
	$("#ClosePe").click(function(){
		disablePopup("schedaPe");
	});
	$("#CloseVe").click(function(){
		disablePopup("schedaVe");
	});
	$("#CloseBr").click(function(){
		disablePopup("schedaBr");
	});
	$("#CloseAr").click(function(){
		disablePopup("schedaAr");
	});
	$("#CloseChi").click(function(){
		disablePopup("schedaChi");
	});
	
	//CLOSING BACKGROUND
	//Click out event!
	$("#backgroundPopup").click(function(){
		return;
		/*disablePopup("schedaAsia");
		disablePopup("schedaNa");
		disablePopup("schedaSa");
		disablePopup("schedaMo");
		disablePopup("schedaMx");
		
		disablePopup("schedaIt");
		disablePopup("schedaSp");
		disablePopup("schedaAu");
		disablePopup("schedaEst");
		disablePopup("schedaBe");
		disablePopup("schedaUk");
		disablePopup("schedaPt");
		disablePopup("schedaFr");
		
		disablePopup("schedaCo");
		disablePopup("schedaPe");
		disablePopup("schedaVe");
		disablePopup("schedaBr");*/
		
	});
	
	

// POPUP - CONTACTUS.PHP

		$("#n-america_c").click(function(){
			//centering with css
			centerPopup("schedaNa");
			//load popup
			loadPopup("schedaNa");
		});

		$("#brasile_c").click(function(){
			//centering with css
			centerPopup("schedaBr");
			//load popup
			loadPopup("schedaBr");
		});
		
		$("#belgium_c").click(function(){
			//centering with css
			centerPopup("schedaBe");
			//load popup
			loadPopup("schedaBe");
		});
		
		$("#mexico_c").click(function(){
			//centering with css
			centerPopup("schedaMx");
			//load popup
			loadPopup("schedaMx");
		});
		
		$("#colombia_c").click(function(){
			//centering with css
			centerPopup("schedaCo");
			//load popup
			loadPopup("schedaCo");
		});
		
		$("#peru_c").click(function(){
			//centering with css
			centerPopup("schedaPe");
			//load popup
			loadPopup("schedaPe");
		});
		
		$("#venezuela_c").click(function(){
			//centering with css
			centerPopup("schedaVe");
			//load popup
			loadPopup("schedaVe");
		});
		
		$("#africa_c").click(function(){
			//centering with css
			centerPopup("schedaAfrica");
			//load popup
			loadPopup("schedaAfrica");
		});
		
		$("#austria_c").click(function(){
			//centering with css
			centerPopup("schedaAu");
			//load popup
			loadPopup("schedaAu");
		});
		
		$("#switz_c").click(function(){
			//centering with css
			centerPopup("schedaAu");
			//load popup
			loadPopup("schedaAu");
		});
		
		$("#germany_c").click(function(){
			//centering with css
			centerPopup("schedaAu");
			//load popup
			loadPopup("schedaAu");
		});
		
		$("#spain_c").click(function(){
			//centering with css
			centerPopup("schedaSp");
			//load popup
			loadPopup("schedaSp");
		});
		
		$("#france_c").click(function(){
			//centering with css
			centerPopup("schedaFr");
			//load popup
			loadPopup("schedaFr");
		});
		
		$("#portugal_c").click(function(){
			//centering with css
			centerPopup("schedaPt");
			//load popup
			loadPopup("schedaPt");
		});
		
		$("#india_c").click(function(){
			//centering with css
			centerPopup("schedaIndia");
			//load popup
			loadPopup("schedaIndia");
		});
		
		
		$("#CloseNa").click(function(){
			disablePopup("schedaNa");
		});
		$("#CloseIndia").click(function(){
			disablePopup("schedaIndia");
		});
		$("#CloseBr").click(function(){
			disablePopup("schedaBr");
		});
		$("#CloseBe").click(function(){
			disablePopup("schedaBe");
		});
		$("#CloseMx").click(function(){
			disablePopup("schedaMx");
		});
		$("#CloseCo").click(function(){
			disablePopup("schedaCo");
		});
		$("#ClosePe").click(function(){
			disablePopup("schedaPe");
		});
		$("#CloseVe").click(function(){
			disablePopup("schedaVe");
		});
		$("#CloseAr").click(function(){
			disablePopup("schedaAr");
		});
		$("#CloseChi").click(function(){
			disablePopup("schedaChi");
		});
		$("#CloseAfrica").click(function(){
			disablePopup("schedaAfrica");
		});
		$("#CloseAu").click(function(){
			disablePopup("schedaAu");
		});
		$("#CloseSp").click(function(){
			disablePopup("schedaSp");
		});
		$("#CloseFr").click(function(){
			disablePopup("schedaFr");
		});
		$("#ClosePt").click(function(){
			disablePopup("schedaPt");
		});
		});

