function setOpacity(objectId,objectOpacity) {
	if (document.all){
		document.all(objectId).filters.alpha.opacity = objectOpacity
	} else if (!document.all && document.getElementById) {		
		document.getElementById(objectId).style.MozOpacity = objectOpacity/100
	}
}

function scaleDiv() {
	resTest = false

	d1w = d1.offsetWidth - wAmount
	d1h = d1.offsetHeight - hAmount
	
	if (d1w > d2.offsetWidth) {
		d1.style.width = d1w + "px"
		resTest = true
	}

	if (d1h > d2.offsetHeight) {
		d1.style.height = d1h + "px"
		resTest = true
	}
	
	if (resTest) {
		setTimeout("scaleDiv()",1)
	}
}

function moveDiv() {
	resTest = false

	d1l = d1.offsetLeft + lAmount
	//d1t = d1.offsetTop + tAmount
	
	if (d1l < leftDist) {
		d1.style.left = d1l + "px"
		resTest = true
	}

	/*if (d1t < d2.offsetTop) {
		d1.style.top = d1t + "px"
		resTest = true
	}*/
	
	if (resTest) {
		setTimeout("moveDiv()",1)
	}
	else
		fadeDivOff();
}

function fadeDivOn() {
	//console.log(divOpacity);
	divOpacity = divOpacity + oAmount
	if (divOpacity <= 100) {
		setOpacity("bigDiv",divOpacity)
		setTimeout("fadeDivOn()",1)
	}
	if(divOpacity>100)
		//moveDiv()
		setTimeout("fadeDivOff()",dispDuration);
}
function fadeDivOff() {
	//console.log(divOpacity);
	divOpacity = divOpacity - oAmount
	if (divOpacity > 0) {
		setOpacity("bigDiv",divOpacity)
		setTimeout("fadeDivOff()",1)
	}
	else
		dontShowMe()
}

function initial()
{
	d1.style.display='block';
	d1.style.left= (document.body.clientWidth - d1.clientWidth)/2;
	d1.style.top= (document.body.clientHeight - d1.clientHeight)/2;
	//layerXPos=((document.body.clientWidth-778)/2);
	//d1.style.left=layerXPos;
	fadeDivOn();
}

function doTest() {
	//scaleDiv()
	//setTimeout("moveDiv()",10000);
	//setTimeout("fadeDivOff()",20000);
	if(!Get_Cookie("showLayer") || Get_Cookie("showLayer")!="no")
		setTimeout("initial()",startDelay);
}

var d1,d2,divOpacity,steps,wAmount,hAmount,lAmount,tAmount,oAmount,leftDist,dispDuration,startDelay,layerXPos
function prepareAnimation() {
	d1 = document.getElementById("bigDiv")

	//d2 = document.getElementById("smallDiv")
	
	divOpacity = 0
	steps = 100
	
	//wAmount = Math.round((d1.offsetWidth - d2.offsetWidth)/steps)
	//hAmount = Math.round((d1.offsetHeight - d2.offsetHeight)/steps)
	//lAmount = Math.round((d2.offsetLeft - d1.offsetLeft)/steps)
	lAmount=1
	//console.log(lAmount);
	leftDist=600
	//tAmount = Math.round((d2.offsetTop - d1.offsetTop)/steps)
	oAmount = 4
}


//----------------------------------------------------------------------------
function Get_Cookie( name ) {
	
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function Set_Cookie( name, value) {
	document.cookie = name + "=" +escape( value );
}

function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) )  document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function dontShowMe()
{
//	Set_Cookie("showLayer","no");
	d1.style.display='none';
}
