/* requires methods */
document.write('<script type="text/javascript" src="/js/dommenu/domLib.js"><\/script>');
document.write('<script type="text/javascript" src="/js/dommenu/domMenu.js"><\/script>');
document.write('<script type="text/javascript" src="/js/prototype.js"><\/script>');
document.write('<script type="text/javascript" src="/js/wow.js"><\/script>');
document.write('<script type="text/javascript" src="/js/scriptaculous/scriptaculous.js"><\/script>');
document.write('<script type="text/javascript" src="/js/tooltip.js"><\/script>');

function PegasusAjaxRequest(url,name){
	new Ajax.Request(url, { method:'get' ,  
		onSuccess: function(transport) {
			if(name!=''){
				document.getElementById(name).innerHTML=transport.responseText;
			}
  		}
	});
}

function PegasusChangeBasketAjaxRequest(url,name){
	createLoading();
	new Ajax.Request(url, {
		onSuccess: function(transport) {
			if(name!=''){
				document.getElementById(name).innerHTML=transport.responseText;
			}
			PegasusReloadBasket();
  		}
	});
	 setTimeout("removePopUp('popUpLoadBasket')", 1250);
}


function PegasusAddToBasket( i00nr01 , quan , i47nr01  ){
	PegasusChangeBasketAjaxRequest('/pegasus/global/add_product_to_basket.php?addtobasket=' + i00nr01 + '&quan=' + quan + '&i47nr01=' + i47nr01 , '');
}

function PegasusRemoveFromBasket( zb0nr01 , quan   ){
	PegasusChangeBasketAjaxRequest('/pegasus/global/remove_product_from_basket.php?remfrombasket=' + zb0nr01 + '&quan=' + quan  , '');
}


function PegasusReloadBasket(){
	PegasusAjaxRequest('/pegasus/global/reload_basket.php' , 'basket') ;
}


var browser=navigator.appName;
function createPopUp(url_par){
  
	var ni = document.getElementById('body');
  	
	if (browser!="Microsoft Internet Explorer"){
		document.getElementById('maindiv').style.opacity=0.4;
  	}else{
		document.getElementById('maindiv').style.filter = 'alpha(opacity=40)';
  	}
  	
	//  document.getElementById('maindiv').style.opacity=0.4;
	  var newdiv = document.createElement('div');
	  newdiv.setAttribute('id','popEvent');
	  ni.appendChild(newdiv);
	  newdiv.style.position  = "absolute";
	  newdiv.style.left      = '150px';
	  newdiv.style.right     = '150px';
	  newdiv.style.top       = '100px';
	  newdiv.style.bottom    = '100px';
	  newdiv.style.width     = "900px";
	  newdiv.style.height    = "500px";
	  newdiv.style.overflow  = "scroll";
	  newdiv.zindex=100;
	
	  nametxt='popEvent';
	  var url=url_par;
	  //alert(url_par);
	  PegasusAjaxRequest(url_par,nametxt);
  
}

function createLoading(){
  
	var ni = document.getElementById('body');
  	
	if (browser!="Microsoft Internet Explorer"){
		document.getElementById('maindiv').style.opacity=0.4;
  	}else{
		document.getElementById('maindiv').style.filter = 'alpha(opacity=40)';
  	}
  	
	  var newdiv = document.createElement('div');
	  newdiv.setAttribute('id','popUpLoadBasket');
	  ni.appendChild(newdiv);
	  newdiv.style.position  = "fixed";
	  newdiv.style.left      = '500px';
	  newdiv.style.right     = '150px';
	  newdiv.style.top       = '250px';
	  newdiv.style.bottom    = '100px';
	  newdiv.style.width     = '180px';
	  newdiv.style.height    = '43px';
	  newdiv.style.overflow  = "hidden";
	  newdiv.zindex=100;
	
	  nametxt='popUpLoadBasket';
	  var url='/pegasus/global/loading.php';
	  PegasusAjaxRequest(url,nametxt);
	 
  
}

function removePopUp(id){
  var idd  = id;
  var ni   = document.getElementById('body');
  var elem = document.getElementById(idd);
  ni.removeChild(elem);
	if (browser!="Microsoft Internet Explorer"){
		document.getElementById('maindiv').style.opacity=1;
  	}else{
		document.getElementById('maindiv').style.filter = 'alpha(opacity=100)';
  	}
}


function collapse_div(id){
	Effect.BlindUp(id);
}

function expand_div(id){
	Effect.BlindDown(id);
}

