
function decision2(message, url){
//if(confirm(message)) location.href = url;


if(confirm(message))
{ 
location = url;
} 
else 
{ 

} 


}


function decision(message, url){
	//if(alert(message)) location.href = url;
	alert(message);
	 location.href = url;
}

// open browser window
function openPopUp(url, windowName, w, h, scrollbar) {

           var winl = (screen.width - w) / 2;
           var wint = (screen.height - h) / 2;
           winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrollbar ;
		   win = window.open(url, windowName, winprops);
           if (parseInt(navigator.appVersion) >= 4) { 
              	win.window.focus(); 
           } 
}
function getImage(imageName)
{
		document.getElementById('img').src = imageName;
}
function jumpMenu(target,object,restore){ 
  eval(target+".location='"+object.options[object.selectedIndex].value+"'");
  if (restore) object.selectedIndex=0;
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// custom add to cart mod: start
 $.fn.ajaxSubmit = function(e) {

    this.submit(function(){
        var params = {};
        $(this)
        .find("input[_40checked], input[_40type='text'], input[@type='hidden'], input[@type='password'], input[@type='submit'], option[@selected], textarea")
        .filter(":enabled")
        .each(function() {
            params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value;
        });
        
        addtocart("addtobasket");
        
        $.post(this.getAttribute("action") + "@call=ajax", params, function(xml){
        
        });
        
        return false;
    });
    
    return this;
}


function askFirst(){
	
	
	       var question = $('#question2')[0]; 
       $.blockUI(question, { width: '350px' });

       $('#cart2').click(function() {
                                       
    window.location = "index.php?act=logout";        
            
    
                
    
       });
       $('#stay2').click(function() {
    window.location = "cart.php?act=cart";      
       });
	
	
}
function addtocart(formName) {
     
 var obj = findObj(formName);
   if (obj != null) {
     
       
       var question = $('#question')[0]; 
       $.blockUI(question, { width: '350px' });

       $('#cart').click(function() {
    
        $.unblockUI();
                             
    window.location = "cart.php?act=cart";        
            
    
                
    
       });
       $('#stay').click(function() {
           $.unblockUI();
          javascript:history.go(0);
       });
   }
   else {
     alert('The form you are attempting to submit called \'' + formName + '\' couldn\'t be found. Please make sure the submitDoc function has the correct id and name.');
   }
} 


function addtocart2(formName,id) {
     
 var obj = findObj(formName);
   if (obj != null) {
     
       
       var question = $('#question'+id)[0]; 
       $.blockUI(question, { width: '350px' });

       $('#cart'+id).click(function() {
    
        $.unblockUI();
                             
    window.location = "cart.php?act=cart";        
            
    
                
    
       });
       $('#stay'+id).click(function() {
           $.unblockUI();
          javascript:history.go(0);
       });
   }
   else {
     alert('The form you are attempting to submit called \'' + formName + '\' couldn\'t be found. Please make sure the submitDoc function has the correct id and name.');
   }
} 
// custom add to cart: end 

function submitDoc(formName) { 
  var obj;
 
	if (obj=findObj(formName)!=null) 
	{
		findObj(formName).submit(); 
	}
	else 
	{
		alert('The form you are attempting to submit called \'' + formName + '\' couldn\'t be found. Please make sure the submitDoc function has the correct id and name.');
	}

}

function addCompare(CompareItem) {
	if (document.compare_form.compare.value == "") {
			document.compare_form.compare.value = CompareItem;
		 } 
	else {
		document.compare_form.compare.value = document.compare_form.compare.value + "," + CompareItem;
	}
}

