// JavaScript Document

function changeFuncnavClass(obj)
{
obj.className = "funcnavOver";	
}
function restoreFuncnavClass(obj)
{
obj.className = "funcnavNormal";	
}



function changeHornavClass(obj)
{
obj.className = "hornavOver";	
}
function restoreHornavClass(obj)
{
obj.className = "hornavNormal";	
}



function changeHorsubnavClass(obj)
{
obj.className = "horsubnavOver";	
}
function restoreHorsubnavClass(obj)
{
obj.className = "horsubnavNormal";	
}




function showMenu(elmnt)
{
	hideAll();
	document.getElementById(elmnt).style.visibility = "visible";
	window.clearTimeout(document.menuTimer);
}
function outMenu() 
{
	document.menuTimer = setTimeout('hideAll()',200);
}
function hideAll()
{
		document.getElementById('horsubnav01').style.visibility = "hidden";
		document.getElementById('horsubnav02').style.visibility = "hidden";
		document.getElementById('horsubnav03').style.visibility = "hidden";	
}
function hideError(){
		document.getElementById('errorWindow').style.visibility = "hidden";
}

function preSelectRadio(radios,value) {
	for (i=0;i<radios.length;i++){
		if (radios[i].value==value){
			radios[i].checked=true;
		}
	}
}

function preSelectCheckboxByName(theForm,value) {
	for (i=0;i<theForm.elements.length;i++) {
    e = theForm.elements[i];
		if ( e.type == 'checkbox' && e.name==value ) {
			e.checked=true;
		}
	}
}

function preSelectCheckboxByValue(theForm,value) {
	for (i=0;i<theForm.elements.length;i++) {
    e = theForm.elements[i];
		if ( e.type == 'checkbox' && e.value==value ) {
			e.checked=true;
		}
	}
}

function LaunchPresentation(path, bChromeless, bResize) {
	var nWidth = screen.availWidth;
	var nHeight = screen.availHeight;

	// Get the width
	if (nWidth > 820)
	{
		nWidth = 980;
		nHeight = 640;
	}

	// Build the options string
	var strOptions = "width=" + nWidth +",height=" + nHeight;
	if (bResize)
	{
		strOptions += ",resizable=yes"
	}

	if (bChromeless)
	{
		strOptions += ", status=0, toolbar=0, location=0, menubar=0, scrollbars=0";
	}
	else
	{
		strOptions += ", status=1, toolbar=1, location=1, menubar=1, scrollbars=1";
	}

	// Launch the URL
	window.open(path , "_blank", strOptions);

}

function submitSearchChannelForm(channel) {
	var _form = document.forms["searchChannelForm"];
	_form.elements["rub"].value=channel;
	_form.submit();
	return false;
}

function submitSimulatorForm(action){
	var _form = document.forms["SimulatorForm"];
	var _parent = window.opener;

	if(action == "Redo") {
		// Redo simulation => close popup
		window.close();
		return false;		
	} else {
		// switch to products(arguments)
		// or send simulation
		_form.target="_self";
		_form.action.value = action;
		_form.submit();
		return false;		
	}
}

function getRefToDivMod( divID, oDoc ) {
	if(!oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y;!y && x < oDoc.layers.length; x++ ) { 
				y = getRefToDivNest(divID,oDoc.layers[x].document); 
			}
			return y; 
		} 
	}
	if( document.getElementById ) { return oDoc.getElementById(divID); }
	if( document.all ) { return oDoc.all[divID]; }
	return document[divID];
}

function popupSimulatorAutoResize() {
	var theID = "main";
	var x = window.self;
	var oW = 0; 
	var ref = getRefToDivMod( theID, x.document ); 
	var oH = ref.clip? ref.clip.height : ref.offsetHeight; 
	x.resizeTo( oW + 200, oH + 200 );
	var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
	if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
	else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
	else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
	if( window.opera &&!document.childNodes ) { myW += 16; }
	x.resizeTo( oW + ( ( oW + 200 ) - myW ), oH + ( (oH + 200 ) - myH ) );
	if( x.focus ) { x.focus(); }
//	return false;
}



