// JavaScript Document

function showResult(code, message, dv, sc) {
	if(dv.length==0)
		dv="#error";
	if(sc.lenght == 0)
		sc = "#success";
	if(code >= 500) {		
		$(dv).html('<label class="labelError_boxresults">' + message + '</label>');
		$(dv).css('display', 'block');
	}
	else {		
		$(sc).html('<label class="labelError_boxresults">' + message + '</label>');
		$(sc).css('display', 'block');
		$(dv).hide('normal');
	}
}


function bookmark(address,sitename) {
 if (window.sidebar) {
 	window.sidebar.addPanel(sitename, address,"");
 } 
 else if( document.all ) {
 	window.external.AddFavorite(address, sitename);
 } 
 else if( window.opera && window.print ) {
 	return true;
 }
}

function add_prod(id){
	buc = document.getElementById('prod_' +id).value;
	if (document.getElementById('ecat_' +id) != null)
		sec = document.getElementById('ecat_' +id).value;
	else sec = "";
	if (document.getElementById('escat_' +id) != null)
		ssec = document.getElementById('escat_' +id).value;
	else ssec = "";
	
	var xmlhttp;
	if (window.XMLHttpRequest)  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  	}
		else if (window.ActiveXObject){
  // code for IE6, IE5
  			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
			else{
  				alert("Your browser does not support XMLHTTP!");
  			}
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
		  //document.myForm.time.value=xmlhttp.responseText;
  		}
	}
	document.getElementById('bempty').style.display = "none";
	document.getElementById('bfull').style.display = "block";
	document.getElementById('text_empty').style.display = "none";
	document.getElementById('text_full').style.display = "block";
	xmlhttp.open("GET","order.php?id="+id+"&buc="+buc+"&sec="+sec+"&ssec="+ssec,true);
	xmlhttp.send(null);
}


function delChart(id){
	document.chart.action= "act/act_chart_del_prod.php?id=" + id;
	document.chart.submit();
}

function delAllChart(){
	document.chart.action= "act/act_chart_del.php";
	document.chart.submit();
}

function updateChart(id){
	document.chart.action= "act/act_chart_update.php?id=" + id;
	document.chart.submit();
}
