// JavaScript Document
// author: joan biarnés
// date: 24/04/2009
// ver: 1.0


// Per tal de manipular les dades de les actualitzacions del software


function afegir_soft(){

	document.getElementById("f_software").action = "frmsoft.php";
	document.getElementById("f_software").method = "post";
	document.getElementById("f_software").submit();
}

function modificar_soft(){

	document.getElementById("f_software").action = "frmsoft.php";
	document.getElementById("f_software").method = "post";
	document.getElementById("f_software").submit();
}
function duplicar_soft(){

	document.getElementById("f_software").action = "brwsoft.php";
	document.getElementById("f_software").method = "post";
	document.getElementById("duplicar").value = 1;
	document.getElementById("f_software").submit();
}
function eliminar_soft(){

	document.getElementById("f_software").action = "brwsoft.php";
	document.getElementById("f_software").method = "post";
	document.getElementById("eliminar").value = 1;
	document.getElementById("f_software").submit();
}
function update_Mysql_soft(){
	
	document.getElementById("f_fsoft").action = "frmsoft.php";
	document.getElementById("f_fsoft").method = "post";
	document.getElementById("up").value = 1;
	document.getElementById("f_fsoft").submit();
	
}

function insert_Mysql_soft(){
	
	document.getElementById("f_fsoft").action = "frmsoft.php";
	document.getElementById("f_fsoft").method = "post";
	document.getElementById("in").value = 1;
	document.getElementById("f_fsoft").submit();
}

/* Ajax */
function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}


function initTable(){
	divScroll = document.getElementById('scroll');
	ajax=objetoAjax();
	ajax.open("GET", "php/scroller.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divScroll.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null);
}

function MostraLogo(enllac){
	divLogo = document.getElementById('d_logo');
	ajax=objetoAjax();
	ajax.open("GET", "php/logo.php?logo="+enllac,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divLogo.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null);
}
