var flashMovie;
var bw;
var myheight=550

var url = window.location.toString();
 //get the parameters
 url.match(/\?(.+)$/);
 var params = RegExp.$1;
 // split up the query string and store in an
 // associative array
 var params = params.split("&");
 var query = {};
 
 for(var i=0;i<params.length;i++)
 {
     var tmp = params[i].split("=");
     query[tmp[0]] = unescape(tmp[1]);
 }

function grow()
{
	if (myheight > 700)
	{
		clearInterval(parent.mygrow)
		return
	}	
	myheight+=25
	flashMovie=getFlashMovieObject("flashPopup");
	flashMovie.height=myheight
}

function setresize()
{
	if (document.all) {
		winW = document.body.offsetWidth+20;
		winH = document.body.offsetHeight;
	}
	else
	{
		winW = window.innerWidth;
		winH = window.innerHeight;
	}

	if (document.getElementById('flashdiv'))
	{
		fwinW = parseInt(winW/2-205)
		if (fwinW < 150) fwinW = 150
		document.getElementById('flashdiv').style.left= fwinW + 'px'
	}	
	if (document.getElementById('netsuite'))
	{
		winW = parseInt((winW-928)/2)
		if (winW < 20) winW = 20
		document.getElementById('netsuite').style.left= winW + 'px'
	}	
}

function showPopup(tn,link)
{
	setTimeout("clearTimeout(parent.hideputimer)",100)
	setTimeout("document.getElementById('flashdiv').style.top='5px'",100)
	setresize()
	if (parent.flashloaded)
		setTimeout("window.document.flashPopup.SetVariable('tn', '"+tn+"')",100);		
	else	
		setTimeout("window.document.flashPopup.SetVariable('tn', '"+tn+"')",1000);		
	parent.flashloaded=true
	if (link) return false
}

function hidePopup()
{
	parent.hideputimer = setTimeout("document.getElementById('flashdiv').style.top='-1000px'; window.document.flashPopup.SetVariable('tn',0)",200)

	//document.getElementById('flashdiv').style.top='-1000px'
	//window.document.flashPopup.SetVariable('tn',1)			
	//window.document.flashPopup.SetVariable('tn',0)			
}

function bol()
{
	document.getElementById("tagline").style.zIndex=1
	document.getElementById("flashdiv").style.zIndex=5
	getCookies()
	if (cookies['bw']<200)
	{
		window.document.flashPopup.SetVariable("bw", 'lb');		
	}	
	//setthumbnail
	setresize()
	if (query['popupTN']) showPopup(query['popupTN'],false)	
}

function flashPopup_DoFSCommand(command, args) { 
	switch (command)
	{
		case 'setCookie':
			//alert(args)
			data = args.split(',')
			setCookie(data[0],data[1],data[2])	
			break;
		default:
			window.status='ERROR: '+command+'----'+args
	}
}

function PassFlash(){
	window.document.flashPopup.SetVariable("closeupText", document.data.mytext.value);
}

function readVariable(mvar)
{
	loadRefresh(flashMovie.GetVariable('/:'+mvar));
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

var cookies=''
function getCookies()
{
temp = document.cookie.split('; ')
cookies = new Array(temp.length);
for (j=0;j<temp.length;j++)
{
	t = temp[j].split('=')
	cookies[t[0]] = unescape(t[1])
}
}

function setCookie(name,value,days)
{
var expire_date = new Date()
expire_date.setTime(expire_date.getTime() + (days * 24 * 60 * 60 * 1000) )
document.cookie = name+'='+escape(value)+'; expires=' + expire_date.toGMTString()
}

function setOpacity(el, opacity)
{
	el = document.getElementById(el)    
	if(el.style.opacity != undefined)
	{
		el.style.opacity = opacity;
	}
	else if( el.style.MozOpacity != undefined)
	{
		el.style.MozOpacity = opacity;
	}
	else if ( el.style.filter != undefined)
	{
		el.style.filter="alpha(opacity="+Math.round(opacity * 100)+")";
	}
}
