// JavaScript Document

function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}

function Left(str, n) {
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function Right(str, n) {
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring((String(str).length-n),String(str).length);
}



function showHide(target,view){
	if($(target).prev("canvas").val()==""){
		target2="canvas";
	}else{
		target2="div";
	}
	if(view==1){
		$(target).show();
		$(target).prev(target2).show();
	}else{
		$(target).hide();
		$(target).prev(target2).hide();
	}
}


//alert(myLang);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///	GESTORE DI CHIAMATE ASINCRONE (GCA)
/// sviluppato da Marco Campanelli
///
///	ISTRUZIONI
///	GCA utilizza la libreria jQuery nella versione jquery-1.3.2.min.js. E' necessario dunque includere tale 
///	libreria prima di utilizzare GCA.
///
///	ARGOMENTI
///
/// myUrl:		è la pagina da caricare dinamicamente eventualmente compresa di percorso e variabili in GET

///	myMethod:	è il metodo di trasporto dati. Accetta GET o POST

/// idForm:		è l'id del form da inviare (lasciare vuoto nel caso di invii in GET)

/// obb:		è la sequenza di campi obbligatori nel formato 0,1,2... (lasciare vuoto nel caso non ci siano 
///				campi obbligatori o in caso di invii in GET)

///	myTarget:	è il DIV dove verrà caricato il file.

///	clear:		valore boleano. True o 1 elimina il contenuto del DIV target prima di caricare 
///				la pagina al suo interno. False o 0 aggiunge al contenuto preesistente la pagina caricata.
///
///	ESEMPI
///	Richiesta pagina GET
///	<a href="javascript:loadObj('pagina.asp?miaVariabile1=mioValore1&miaVariabile2=mioValore2','GET','','','divBersaglio','1');" title="il mio link">il mio link</a>
///	L'esempio carica la pagina "pagina.asp" dentro il div che ha id="divBersaglio" inviando le 2 coppie "variabile" "valore"
///
///	Richiesta pagina POST
///	<a href="javascript:loadObj('pagina.asp?miaVariabile1=mioValore1','POST','clienti','0,1','divBersaglio','1');" title="il mio link">il mio link</a>
///	L'esempio carica in POST la pagina "pagina.asp" dentro il div che ha id="divBersaglio" inviando in GET variabile1=valore1 e 
///	in POST tutti i dati del form che ha come id="clienti". Il valore "0,1" di obb specifica che nel caso il primo o il secondo elemento
///	della form assuma valore='' la richiesta non verrà completata.
///
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
///
///


function attivaErrori(stato){
	if(stato==0){
		showHide('#errorMessage',0);
		$('#errorTitle').empty();
		$('#errorTxt').empty();
	}else{
		showHide('#errorMessage',1);
	}
}

function loadObj(myUrl,myMethod,idForm,obb,myTarget,clear){
    
	//////////////////////////////////////
	///// OGGETTO LOADING
	//////////////////////////////////////

	forceRandom = Math.random()*99999999;
	forceRandom = Math.round(forceRandom);
	
	nSize=18;
	sUnit="px";
	
	myLoadObj=	"<script src='js/loading/loading.js'></script>"+
				"<div style='position: relative; float: left; width: 100%; padding: 25px;'>"+
					"<div id='imgLoad' style='position: relative; float: left; width: "+nSize+sUnit+"; padding-right: 8px;'>"+
						"<div id='imgLoad1' style='position: relative; width: "+nSize+sUnit+"; display: block;'>"+
							"<img src='js/loading/img/1.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad2' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/2.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad3' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/3.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad4' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/4.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad5' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/5.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad6' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/6.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad7' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/7.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
						"<div id='imgLoad8' style='position: relative; width: "+nSize+sUnit+"; display: none;'>"+
							"<img src='js/loading/img/8.png' width='"+nSize+"' height='"+nSize+"' />"+
						"</div>"+
					"</div>"+
					"<div style='position:relative; float:left; width: 50px; padding-top: 2px; color: black;'>loading...</div>"+
				"</div>";
	//////////////////////////////////////
	
	
	//////////////////////////////////////
	///// FUNZIONI AJAX
	//////////////////////////////////////
	function beforeFunction(){
		$("#"+myTarget).empty();
		if(clear==true){$("#"+myTarget).empty();}
		$("#"+myTarget).append(myLoadObj);
	}
	
	function successFunction(data){
		clearInterval(timerID);
		if(clear==true){$("#"+myTarget).empty();}
		$("#"+myTarget).append(data);
	}
	//////////////////////////////////////
	
	

	forceRandom = Math.random()*99999999;
	forceRandom = Math.round(forceRandom);
	if (Right(myUrl,4)=='.asp'){
		myUrlDef = myUrl+'?forceRand='+forceRandom;
	}else{
		myUrlDef = myUrl+'&forceRand='+forceRandom;
	}
	
	//////////////////////////////////////
	///// CONTROLLO I CAMPI OBBLIGATORI PER L'INVIO IN POST
	//////////////////////////////////////
	if(myMethod=='POST'){
		error = 0;
		if(obb!='' || obb!=0){
			//var obbArray = obb.split(',');
			myLoop=0;
			
			// OLD E FUNZIONANTE// $("[nNumber]").each(function(){
																
			// NUOVO IN TEST // 
			$("[nObb]").each(function(){
				if($(this).attr("nObb")=="1"){
					if($(this).attr("type")=="text" && $(this).val()=="" || $(this).attr("type")=="password" && $(this).val()=="" || $(this).attr("type")=="checkbox" && $(this).attr("checked")=="" || $(this).attr("type")=="textarea" && $(this).val()==""){ 
						error++;
						alert($(this).attr("alert")+' is empty.');
					}
				}
		  	});
		}
		//////////////////////////////////////
		
		
		if(error==0) {
			//////////////////////////////////////
			///// INVIO POST
			//////////////////////////////////////
			$.ajax({
				type: myMethod,
				url: myUrlDef,
				data: $("#"+idForm).serialize(),
				dataType: "html",
				beforeSend: function() { 
					beforeFunction();
				},
				success: function(data){
					successFunction(data);
				},
				error:function (xhr, ajaxOptions, thrownError){
					$("#errorMessage").append(xhr.responseText);
					attivaErrori(1);
				}
			});
			//////////////////////////////////////
		}else{
			$("[type='password']").attr("value","");
		}
		
    }else{
		//////////////////////////////////////
		///// INVIO GET
		//////////////////////////////////////
        $.ajax({
            type: myMethod,
            url: myUrlDef,
            dataType: "html",
			beforeSend: function() { 
				beforeFunction();
			},
            success: function(data){
				successFunction(data);
            },
			error:function (xhr, ajaxOptions, thrownError){
				$("#errorMessage").append(xhr.responseText);
				attivaErrori(1);
			}
        });
		//////////////////////////////////////
    }
}

///
///
///
////////////////////////////////////////////////////////////////////







function submitIt(nomeForm,obb) {
	myForm = document.getElementById(nomeForm);
	myFormElements = myForm.elements;
	//obbArray = new Array();
	
	var myError=0;
	if((obb/obb)==1){
		var obbArray = obb.split(',');
		//alert(obbArray[2]);
		
		for(i=0;i<myFormElements.length;i++) {
			//document.getElementById("cont_"+myFormElements[i].name).style.backgroundColor = '';
			if(myFormElements[i].value=="") {
				for(k=0;k<obbArray.length;k++) {
					if(i==(obbArray[k])) {
						myError++;
						//document.getElementById("cont_"+myFormElements[i].name).style.backgroundColor = '';
						alert('Il campo '+myFormElements[i].id+' e\' vuoto.');
					}
					
				}
			}
			
		}
	}
	if(myError==0) {
		myForm.submit();
	}
}


///////////////////////////////////////////////////////


function resetIt(nomeForm) {
	form = document.getElementById(nomeForm);
	myFormElements = form.elements;
	for(i=0;i<myFormElements.length;i++) {
		if(document.getElementById("cont_"+myFormElements[i].name)){
			document.getElementById("cont_"+myFormElements[i].name).style.backgroundColor = '';
		}
	}
	form.reset();
}

function liquidRemove(myObj){
	if($(myObj).prev("canvas").val()==''){
		$(myObj).prev("canvas").remove();
	}else{
		$(myObj).prev("div").remove();
	}	
}


function mostra(attivo,target){
	if(attivo==1){
		valDisplay='block';
	}else{
		valDisplay='none';
	}
	typeSelector=Left(target,1);
	lenTarget=(String(target).length-1);
	
	if(typeSelector=="#"){
		strSelector=document.getElementById(Right(target,lenTarget));
	}
	strSelector.style.display=valDisplay;
}




function codificaPassword(target){
	//alert($(target).val());
	if($(target).val()=='' || $(target).val()==null){
		//alert("vuoto");
		$(target).attr('value','');
	}else{
		$(target).attr('value',hex_md5($(target).val()));
	}
}


function verPass(verNam1,verNam2,page,method,idForm,obb,target,empty) {
	pass1=$(verNam1).val();
	pass2=$(verNam2).val();
	//alert(pass1+" - "+pass2);
	//if(pass1==undefined){
		//alert("no submit");
	//}else{
		if(pass1!=pass2) {
			alert('I campi password non corrispondono');
		} else {
			codificaPassword(verNam1);
			codificaPassword(verNam2);
			loadObj(page,method,idForm,obb,target,empty);
			//submitIt(idForm,obb);
		}
	//}
}

function focusOnInput(nomeInput){
	myInput = document.getElementsByName(nomeInput)[0];
	if(nomeInput=='searchTxt'){
		if(myInput.value=='CERCA'){
			myInput.value='';
		}
	}else{
		myInput.value='';
	}
}

function focusOutInput(nomeInput){
	myInput = document.getElementsByName(nomeInput)[0];
	if(myInput.value==''){
		myInput.value='CERCA'
	}
}

//function userPannell(stato,action,step) {
//	element = document.getElementById('userPannell');
//	//aLink = document.getElementById('aUser1');
//	
//	if(action=='log') {
//		hSize = 160;
//		aLink = document.getElementById('aUser1');
//	
//	} else if(action=='mod') {
//		hSize = 450;
//		aLink = document.getElementById('aUser2');
//	}
//	
//	if(stato==1) {
//		aLink.href = "javascript:userPannell('0','"+action+"','');";
//		element.style.height = '0px';
//		element.style.display = 'block';
//		bytefx.size(
//			element,
//			{width:960,height:hSize},
//			35,
//				function(){
//					forceRandom = Math.random()*99999999;
//					forceRandom = Math.round(forceRandom);
//					completeAHAH.ahah('user.asp?action='+action+'&step='+step+'&rnd='+forceRandom,'userInt','0','GET');
//				}
//			);
//	} else {
//		aLink.href = "javascript:userPannell('1','"+action+"','"+step+"');";
//		
//		bytefx.size(
//			element,
//			{width:960,height:0},
//			35,
//				function(){
//					completeAHAH.ahah('blank.asp','userInt','0','GET');
//					element.style.height = '0px';
//					element.style.display = 'none';
//				}
//			);
//		
//	}
//}


function verificaExt(ext,target) {
	nomeFile = document.getElementById(target).value;
	extFile = nomeFile.split('.');
	extLow = ext;
	extFirstUp = ext.substring(0,1).toUpperCase();
	extUp = ext.toUpperCase();
	if(extFile[(extFile.length-1)]==extLow || extFile[(extFile.length-1)]==extFirstUp || extFile[(ext.length-1)]==extUp) {
	} else {
		alert('Il file selezionato non è un file '+ext+'. Selezionare solo file '+ext+'.');
		document.getElementById(target).value = '';
	}
}
function verificaJPG() {
	nomeFile = document.getElementsByName('imgtmb')[0].value;
	ext = nomeFile.split('.');
	if(ext[(ext.length-1)]=='jpg' || ext[(ext.length-1)]=='Jpg' || ext[(ext.length-1)]=='JPG') {
	} else {
		alert('L\'immagine selezionata non &egrave; un JPG. Selezionare solo immagini formato JPG.');
		document.getElementsByName('imgtmb')[0].value = '';
	}
}



function rollOverBttMenu(id) {
	if (loaded == 1) {
		$('#abttMenu'+id).css({
			color: "white",
			textDecoration: "underline"
		});
		liquidRemove("#bttMenu"+id);
		
		$("#bttMenu"+id).liquidCanvas("fill{color:rgba(255,255,255,0.3);} => rect");
	}
}
function rollOutBttMenu(id) {
	if (loaded == 1) {
		$('#abttMenu'+id).attr("style","color:#666");
		liquidRemove("#bttMenu"+id);
		$("#bttMenu"+id).liquidCanvas("fill{color:#fff;} => rect");
	}
}


function subMenuOn(id,idrand) {
	var position=$("#bttMenu"+id).position();
	document.getElementById("subMenu").style.left=position.left+'px';
	$("#bttMenu"+id).addClass('bttMenuOn');
	loadObj("include/subMenu.asp?id="+id+"&idrand="+idrand,"GET","","","subMenu","1");
	$("#subMenu").show();
}

function subMenuOff() {
	loadObj("blank.asp","GET","","","subMenu","1");
	$("#subMenu").hide();
}

function rollOverBttSubMenu(id) {
	if (loaded == 1) {
		document.getElementById('a'+'bttSubMenu'+id).style.color = 'white';
		$("#bttSubMenu"+id).liquidCanvas("gradient{from:#f9be5c; to:#e36828; xO:0; yO:#50; xD:0; yD:#80;} => rect");
	}
}
function rollOutBttSubMenu(id) {
	if (loaded == 1) {
		document.getElementById('a'+'bttSubMenu'+id).style.color = '#004989';
		if($("#bttSubMenu"+id).prev("canvas").val()==""){
			$("#bttSubMenu"+id).prev("canvas").remove();
		}else{
			$("#bttSubMenu"+id).prev("div").remove();
		}
	}
}



function rollBtt(stato,btt) {
	myBtt = document.getElementById(btt);
	if(stato==1) {
		myBtt.style.color = 'black';
	} else {
		myBtt.style.color = 'white';
	}
}

function goToPage(pag) {
	if (loaded == 1) {
		document.location.href = 'index.asp?zona='+pag;
	}
}

function gotoAHAH(url,target) {
	completeAHAH.ahah(url,target,'0','GET');
}


//FUNZIONI DELLA HOME

function detectFF() {
	if(navigator.userAgent.indexOf("Firefox")!=-1){
		trovato = 'FF';
	} else if (navigator.appVersion.indexOf("MSIE")!=-1){
		trovato = 'IE';
	} else {
		trovato = 'UNKNOW';
	}
}

function ridOscura() {
	width = document.body.offsetWidth;
	height = document.documentElement.clientHeight;
	
	contH = document.getElementById('contInt').clientHeight;
	//alert(contH);
	if(height == 0) {
		detectFF();
		if (trovato == 'IE') {
			if(height1 >= height2) {
				height = document.documentElement.scrollHeight;
			} else {
				height = document.documentElement.clientHeight;
			}
			//alert(trovato);
		} else if (trovato == 'FF') {
			height = document.documentElement.scrollHeight;
			//alert(trovato);
		} else {
			height = document.documentElement.offsetHeight;
			//alert(trovato);
		}
	}
	//alert('w='+width+' h='+height);
	element = document.getElementById('oscura');
	element.style.width = width+'px';
	
	if(height<contH) {
		height = contH+100;
	}
	element.style.height = height+'px';
}

function popDoc(cCount,zona) {
	window.open('doc.asp?cCount='+cCount+'&zona='+zona,'allegato','700,500');
}

function popUp(vis,id,zona) {
	if (vis == 1) {
		pageToLoad = zona+'.asp';
		if (document.getElementById('popUp').style.display != 'block') {
			ridOscura();
			bytefx.alpha(element, 0);
			bytefx.fade(element, 0, 80, 15, function(){
			});
			element.style.display = 'block';
		
		
			rand = Math.floor(Math.random()*99999999);
			
			//if(document.body.scrollTop == '') {	
				document.getElementById('popUp').style.top = (document.body.scrollTop+25)+'px';
			//} else {
				//document.getElementById('popUp').style.top = (document.documentElement.scrollTop+25)+'px';
			//}
			
			document.getElementById('popUp').style.display = 'block';
		}
		completeAHAH.ahah(pageToLoad+'?id='+id+'&rnd='+rand,'popUp','0','GET');
	} else {
		completeAHAH.ahah('blank.asp','popUp','0','GET');
		document.getElementById('popUp').style.display = 'none';
		element = document.getElementById('oscura');
		bytefx.fade(element, 80, 0, 15, function(){
			document.getElementById('oscura').style.display = 'none';
		});
		//bytefx.alpha(element, 0);
	}
}

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);

function getMouseXY(e,posizione) {
	
	//var tempX = 0;
	//var tempY = 0;

	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
		if(document.body.scrollTop) {
			tempY = event.clientY + document.body.scrollTop;
		} else {
			tempY = event.clientY + document.documentElement.scrollTop;
		}
		
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
		tempY = e.pageY;
		//alert(tempX, tempY);	
	}  
	// catch possible negative values in NS4
	if (tempX < 0) {
		tempX = 0;
	}
	
	if (tempY < 0) {
		tempY = 0;
	} 
	

					
		objDiv = document.getElementById('popUpImg');
		objHeight = objDiv.offsetHeight;
		
		objDiv.style.top = tempY+25+'px';
		//objDiv.style.top = tempY-(objHeight/2)-50+'px';
		
		objDiv.style.left = tempX-55+'px';
		
		

  return true
}


function popUpImg(vis,img,imgmdl) {
	if (vis == 1) {
		
		ridOscura();
		
		//element = document.getElementById('oscura');
		//bytefx.alpha(element, 0);
		//element.style.display = 'block';
		//bytefx.alpha(element, 0);
		//bytefx.fade(element, 0, 80, 15, function(){
		//});
		//rand = Math.floor(Math.random()*99999999);
		rand = Math.floor(Math.random()*99999999);
		document.onmousemove = getMouseXY;
		pageToLoad = 'popupImg.asp?img='+img+'&imgmdl='+imgmdl+'&rnd='+rand;
		
		//document.getElementById('popUp').style.top = tempY-15+'px';
		document.getElementById('popUpImg').style.display = 'block';
		completeAHAH.ahah(pageToLoad,'popUpImg','0','GET');
	} else {
		completeAHAH.ahah('blank.asp','popUpImg','0','GET');
		document.getElementById('popUpImg').style.display = 'none';
		//element = document.getElementById('oscura');
		//bytefx.fade(element, 80, 0, 15, function(){
			//document.getElementById('oscura').style.display = 'none';									 
		//});
	}
}


function controlloCampi() {
	var stopIt = 0;
	var form = document.contact;
	var nome = form.nome.value;
	var cognome = form.cognome.value;
	var azienda = form.azienda.value;
	var indirizzo = form.indirizzo.value;
	var cap = form.cap.value;
	var citta = form.citta.value;
	var tel = form.tel.value;
	var email = form.email.value;
	var oggettoMsg = form.oggettoMsg.value;
	var corpoMsg = form.corpoMsg.value;
	corpoMsg.replace("\r","<br />");
	
	//CONDIZION
	
	if (nome == "") {
		alert("non hai inserito il nome");
		stopIt = 1;
	}
	if (cognome == "") {
		alert("non hai inserito il cognome");
		stopIt = 1;
	}
	if (email == "") {
		alert("non hai inserito la mail");
		stopIt = 1;
	}
	if (oggettoMsg == "") {
		alert("non hai inserito l'oggetto");
		stopIt = 1;
	}
	if (corpoMsg == "") {
		alert("non hai inserito il corpo del messaggio");
		stopIt = 1;
	}
	if (stopIt == 0) {

				
		//Applico replace per sostituire Pippo con Pluto
		corpoMsg = corpoMsg.replace(/\n/g, '<br>');
		
		
		//alert(corpoMsg);
		completeAHAH.ahah('popup.asp?step=2&nome='+nome+'&cognome='+cognome+'&azienda='+azienda+'&indirizzo='+indirizzo+'&cap='+cap+'&citta='+citta+'&tel='+tel+'&email='+email+'&oggettoMsg='+oggettoMsg+'&corpoMsg='+corpoMsg,'popup','0','GET');
		//ahah('insertCliente.asp','toDb');
	}
}


//FUNZIONI DELLA GALLERY
function allineaImg(target) {
	element = document.getElementById(target);
	//bytefx.alpha(element, 0);
	hImg = element.offsetHeight;
	wImg = element.offsetWidth;
	hBox = document.getElementById('out'+target).clientHeight;
	wBox = document.getElementById('out'+target).clientWidth;
	topImg = (hBox-hImg)/2;
	leftImg = (wBox-wImg)/2;
	//if (topImg > 0) {
		element.style.marginTop = topImg+'px';
		element.style.marginLeft = leftImg+'px';
	//}
	
	//bytefx.alpha(element, 100);
}

sel = '';

function inizializzaGallery(iniSel,lrg) {
	
	//document.getElementById('lrgCont').style.display = 'none';
	
	hFoto = document.getElementById('lrg').clientHeight;
	
	element = document.getElementById('lrgCont');
	bytefx.alpha(element, 0);
	//element.style.height = hFoto+'px';
	//alert(hFoto);
	if(hFoto != '') {
		document.getElementById('loading').style.paddingTop = ((hFoto/2)-15)+'px';
	} else {
		document.getElementById('loading').style.paddingTop = '180px';
	}
	document.getElementById('loading').style.display = 'block';
	document.getElementById('loading').innerHTML = '<img src="img/loading.gif" style="border:none;" />';

	element = document.getElementById('outtmb'+iniSel);
	element.style.borderColor = '#ec651d';
	if(sel != '' && sel != iniSel) {
		element = document.getElementById('outtmb'+sel);
		element.style.borderColor = '#0094D3';
	}
	
	//document.getElementById('titTxt').innerHTML = txtXS;
	//document.getElementById('descTxt').innerHTML = txtS;
	
	document.getElementById('lrg').src = lrg;
	//document.getElementById('lrgCont').style.display = 'block';
	sel = iniSel;
}

function galleryLoaded() {
	document.getElementById('loading').innerHTML = '';
	document.getElementById('loading').style.display = 'none';
	element = document.getElementById('lrgCont');
	bytefx.fade(element, 0, 100, 15, function(){
		//document.getElementById('loading').style.display = 'none';
	});
}

function tmbOn(id) {
	document.getElementById('outtmb'+id).style.borderColor = '#66ff00';
}

function tmbOff(id) {
	if(sel !== id) {
		document.getElementById('outtmb'+id).style.borderColor = '#2f4f4f';
	}
}

function tmbClick(id,txtXS,txtS,lrg) {
	document.getElementById('outtmb'+sel).style.borderColor = '#ccc';
	document.getElementById('outtmb'+id).style.borderColor = '#ec651d';
	sel = id;
	document.getElementById('titTxt').innerHTML = txtXS;
	document.getElementById('descTxt').innerHTML = txtS;
	document.getElementById('lrg').src = 'mdb-database/Media/'+lrg;
}

function loadPage(nPage) {
	completeAHAH.ahah('tmbGallery.asp?page='+nPage,'tmb','0','GET');
}


