﻿// Popup
function popup( page, width, height ) {
	window.open( page, 'vmzincpopup', "width=" + width + ",height=" + height + ",menubar=no,location=no,resizable=no,scrollbars=no,status=no" )
};


// Display none - block
function hideMe(obj) {
	var objStyle = document.getElementById(obj).style;
	objStyle.display = (objStyle.display == 'none') ? '' : 'none';
	arrObj = document.images["b" + obj].src;
	arrObj = (objStyle.display == 'none') ? arrObj.replace('2.g', '1.g') : arrObj.replace('1.g', '2.g');
	document.images["b" + obj].src = arrObj;
}


// Table hover cells
String.prototype.has = function( pSubStr ) {
	if( this.indexOf( pSubStr ) != -1 ) {
		return(true);
	}
	return(false);
}
function glueClass( obj, pClassName ) {
	if( !obj.className ) {
		obj.className = pClassName;
	} else {
		if( !obj.className.has( pClassName ) ) obj.className += ' ' + pClassName;
	}
}
function unGlueClass( obj, pClassName ) {
	if( obj.className.has( pClassName ) ) {
		obj.className = obj.className.replace( ' ' + pClassName, '' );
		obj.className = obj.className.replace( pClassName, '' );
	}
}
function hoverCell( pItems, pState ) {
	var hcItems = pItems.split( "," );
	for ( i in hcItems ) {
		var target = document.getElementById( "hc" + hcItems[i] );
		if ( pState == 1 ) {
			glueClass( target, 'over' );
		} else{
			unGlueClass( target, 'over' );
		}
	}
}
function enableCellHovers( pHovSources, pHovTargets ) {
	var mergedTargets = pHovTargets;
	var hSources = pHovSources.split( "," );
	//gather all possible targets
	for( i in hSources ) {
		mergedTargets = mergedTargets + ',' + hSources[i];
	}
	//add functions to source items
	for ( i in hSources ) {
		var tCell = document.getElementById( "hc" + hSources[i] );
		tCell.onmouseover = function() {
			hoverCell( mergedTargets, 1 );
		}
		tCell.onmouseout = function() {
			hoverCell( mergedTargets, 0 );
		}
	}
}


function orderForm(pSelf) {
	var actContainer = pSelf.parentNode.parentNode;
	for (var i = 0; i < actContainer.childNodes.length; i++) {;
		if ((actContainer.childNodes[i].nodeName == "DIV") && (actContainer.childNodes[i].className == "orderLayer")) {
			if (actContainer.childNodes[i].style.display == "none") {
				actContainer.childNodes[i].style.display = "block";
			} else {
				actContainer.childNodes[i].style.display = "none";
			}
		}
	}
}

function closeForm (pSelf) {
	var formContainer = pSelf.parentNode.parentNode.parentNode;
	formContainer.style.display = "none";
}

function goNews() {
	location.href = "Hirek.aspx"
}

function affiche(id) {
	if (document.getElementById) {
		document.getElementById(id).style.visibility="visible";
	} else if (document.all) {
		document.all[id].style.visibility="visible";
	} else if (document.layers) {
		document.layers[id].visibility="visible";
	}
}

function efface(id) {
	if (document.getElementById) {
		document.getElementById(id).style.visibility="hidden";
	} else if (document.all) {
		document.all[id].style.visibility="hidden";
	} else if (document.layers) {
		document.layers[id].visibility="hidden";
	}
}

function fenetre(info) { 
	type=window.open(''+info+'','nouveau',"scrollbars=auto,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,width=550,height=320,top=10,left=10");
	if (type != null && type.opener == null) type.opener= self;
}
