function writeFlash(movieLocation,flashwidth,flashheight,noflashsrc,noflashurl,myidname) {
	if (myidname) { document.write('<div id="'+myidname+'">'); }
	if ((noflashsrc) && ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) )) {
		if (noflashurl) { document.write('<a href="'+noflashurl+'" >');}
		if (noflashsrc) { document.write('<img src="'+noflashsrc+'" />');}
		if (noflashurl) { document.write('</a>');}
	} else {
		document.write('<object type="application/x-shockwave-flash" width="'+flashwidth+'" height="'+flashheight+'" data="'+movieLocation+'"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+movieLocation+'" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /></object>');
	}

	if (myidname) { document.write('</div>'); }
}


function mnuhide(id){
	obj = document.getElementById(id); 
	obj.style.display = "none";
}

function mnushow(id){
	obj = document.getElementById(id); 
	obj.style.display = "";	
} 

function mnuhideall(){
	mnuhide('mnuNews');
	mnuhide('mnuCust');
	mnuhide('mnuPartners');
	mnuhide('mnuCompany');
	mnuhide('mnuProduct');
	mnuhide('mnuContact');
	mnuhide('mnuTech');
	mnuhide('mnuServices');
}


function openWin(aPage,aPageID,iWidth,iHeight) {
	var sWindowInfo;
	sWindowInfo = "resizable=yes,width=" +iWidth+ ",height=" + iHeight + ",top=0,left=0,toolbar=no, status=yes, scrollbars=no"
	var aWin = window.open(aPage, aPageID, sWindowInfo);
	return aWin;
}

function openWinSB(aPage,aPageID,iWidth,iHeight) {
	var sWindowInfo;
	sWindowInfo = "resizable=yes,width=" +iWidth+ ",height=" + iHeight + ",top=0,left=0,toolbar=no, status=yes, scrollbars=yes"
	var aWin = window.open(aPage, aPageID, sWindowInfo);
	return aWin;
}

/****************************************************
 AntiSpambotMailto() - Documentation and encoder at:
    http://www.kenric.com/AntiSpambotMailto.html
****************************************************/
function AntiSpambotMailto(codelist, description, atagattr) {
	var thiscode, thischar;
	var CodeString = new String(codelist);
	var CodedArray = CodeString.split('|');
	var L = CodedArray.length;
	var AddrDecoded = "";
	for (var x=0; x < L; x++) {
		thiscode = CodedArray[x];
		thischar = String.fromCharCode( thiscode - L );
		AddrDecoded += thischar;
	}
	atagattr = atagattr ? ' ' + atagattr : '';
	if (!description) description = AddrDecoded; // if no description supplied, display email address
	var strOutput = '<a href="mailto:'+AddrDecoded+'"' + atagattr+'>' + description + '</a>';
	document.write(strOutput);
}


function getElement(elementx)
{	var elem;
		if (navigator.appName == 'Microsoft Internet Explorer')
			elem = document.all(elementx);
		else
		{
		    if (navigator.appName == 'Opera')
		        elem = document.getElementById(elementx);
		    else
		    {
			    elem = document.getElementById(elementx);
			    if (elem==null) // get element by index number
				    elem = document.forms[0].elements[elementx];
			}
		}
	return elem;
}


/* Popup Window Code */

// Browser safe opacity handling function

function setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function myPopupRelocate() {
 var scrolledX, scrolledY;
 if( self.pageYOffset ) {
   scrolledX = self.pageXOffset;
   scrolledY = self.pageYOffset;
 } else if( document.documentElement && document.documentElement.scrollTop ) {
   scrolledX = document.documentElement.scrollLeft;
   scrolledY = document.documentElement.scrollTop;
 } else if( document.body ) {
   scrolledX = document.body.scrollLeft;
   scrolledY = document.body.scrollTop;
 }

 var centerX, centerY;
 if( self.innerHeight ) {
   centerX = self.innerWidth;
   centerY = self.innerHeight;
 } else if( document.documentElement && document.documentElement.clientHeight ) {
   centerX = document.documentElement.clientWidth;
   centerY = document.documentElement.clientHeight;
 } else if( document.body ) {
   centerX = document.body.clientWidth;
   centerY = document.body.clientHeight;
 }

 var leftOffset = scrolledX + (centerX - 250) / 2;
 var topOffset = scrolledY + (centerY - 200) / 2;

 document.getElementById("styled_popup").style.top = topOffset + "px";
 document.getElementById("styled_popup").style.left = leftOffset + "px";
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }

 setTimeout('closeMyPopup()', 800 );
}

function closeMyPopup() {
 document.getElementById("styled_popup").style.display = "none"
}

function fireMyPopup() {
 myPopupRelocate();
 setOpacity( 0 );
 document.getElementById("styled_popup").style.display = "block";
 fadeInMyPopup();
 document.body.onscroll = myPopupRelocate;
 window.onscroll = myPopupRelocate;
}

