/////////////////////////////////////////////////////////////// JS
// js_gfx.js - Filippo Grassilli - MasterTravel
/////////////////////////////////////////////////////////////// JS

/////////////////////////////////////////////////////////////// JS
// SetLinkButtonAction(butName)
// Imposta handling di onMouseOver e onMouseOut per gli HREF
// parents delle immagini con dato NAME per swap delle immagini
// USO: <a href=/><img src=but.gif name=bname>Link</a>
// USO: <script>SetLinkButtonAction("bname");</script>
function SetLinkButtonAction(butName) {
    var myName=document.getElementsByName(butName);
    for(f=0; f<myName.length; f++) {
	myName[f].parentNode.onmouseover=function() {
	    for(i=0; i<this.childNodes.length; i++) {
		if(this.childNodes[i].name==butName) {
		    this.childNodes[i].src=this.childNodes[i].src.replace(/\.(gif|png|jpg)$/gi,"p.$1");
		}
	    }
	}
	myName[f].parentNode.onmouseout=function() {
	    for(i=0; i<this.childNodes.length; i++) {
		if(this.childNodes[i].name==butName) {
		    this.childNodes[i].src=this.childNodes[i].src.replace(/p\.(gif|png|jpg)$/gi,".$1");
		}
	    }
	}
    }
}

function mmTog(sid) {
    var msdiv=document.getElementById("mstate"+sid);
    if(!msdiv) return;
    if(msdiv.style.display=='none') msdiv.style.display='';
    else msdiv.style.display='none';
}

