﻿
var nn4 = (document.layers) ? true : false
var ie = (document.all) ? true : false
var dom = (document.getElementById && !document.all) ? true : false 


function clipValue(id) {
var layer = browser(id)

	if(nn4){
	topdiv = layer.clip.top
	rightdiv = layer.clip.right
	bottomdiv = layer.clip.bottom
	leftdiv = layer.clip.left
	rectVal = topdiv +","+ rightdiv +","+ bottomdiv +","+ leftdiv
	return rectVal
	}
	else{
	rectVal = layer.style.clip
	return rectVal
	}

}

var topVal = 0; //set these vars as global so they are not reset for each setTimeout call to the function
var rightVal = 500;
var bottomVal = 500;
var leftVal = 500;



function closeCurtain(id) {
   
   
    var layer = document.getElementById(id) //get path to layer depending on browser executing this code
    if (leftVal > 0) {
        topVal += 0;
        rightVal += 0;
        bottomVal += 0;
        leftVal -= 20;
        layer.style.clip = "rect(" + topVal + "px " + rightVal + "px " + bottomVal + "px " + leftVal + "px)";
        setTimeout("closeCurtain('" + id + "')", 20)
       }



   }

   var topVal2 = 0; //set these vars as global so they are not reset for each setTimeout call to the function
   var rightVal2 = 500;
   var bottomVal2 = 0;
   var leftVal2 = 500;
   
   function topDownCurtain(id) {
       var btn = document.getElementById("divPopAdBtn")
       btn.style.visibility = "hidden";
       

       var layer = document.getElementById(id) //get path to layer depending on browser executing this code
      
      
       if (bottomVal <= 500) {
           topVal += 0;
           rightVal += 0;
           bottomVal2 += 20;
           leftVal = 0;
           bottomVal = bottomVal2
           layer.style.clip = "rect(" + topVal + "px " + rightVal + "px " + bottomVal + "px " + leftVal + "px)";
           setTimeout("topDownCurtain('" + id + "')", 20)
       }


   }

   

   function closeCurtainTimer() {
setTimeout('closeCurtain("purple")',30000); //delay for 30sec
   }




   function resetValues(id) {
     
       var btn = document.getElementById("divPopAdBtn")
       btn.style.visibility = "visible";
       
    var layer = document.getElementById(id)
    
    topVal = 0;
    rightVal = 500;
    bottomVal = 500;
    leftVal = 500;
    bottomVal2 = 0;

    layer.style.clip = "rect(" + topVal + "px " + rightVal + "px " + bottomVal + "px " + leftVal + "px)";
    
//layer.style.visibility = "hidden";
}

function slideDiagonal(id, y) {
    layer = document.getElementById(id)    // get layer path from global browser function

    var yposition = (nn4) ? layer.top : parseInt(layer.style.top)
    var xposition = (nn4) ? layer.left : parseInt(layer.style.left)

    if (yposition < y) {

        yposition += 5
        
        if (nn4) {
            layer.top = yposition
        }
        else {
            layer.style.top = yposition
        }

        xposition += 5
        
        if (nn4) {
            layer.left = xposition
        }
        else {
            layer.style.left = xposition
        }

        setOpacity(50, id) 
        setTimeout("slideDiagonal('" + id + "'," + y + ")", 10)
        layer.visibility = 'visible'
    }

}

function setOpacity(opacity, id) {

    banner1 = document.getElementById(id);

    opacity = (opacity == 100) ? 99.999 : opacity;
    banner1.style.filter = "alpha(opacity:" + opacity + ")";
    banner1.style.KHTMLOpacity = opacity / 100;
    banner1.style.MozOpacity = opacity / 100;
    banner1.style.Opacity = opacity / 100;

}