<!--
/**
 * Flash Version Popup
 *
 * This script is used to display a popup if a user tries to play
 * a preview but has the wrong flash version installed. It will
 * show the popup and 'grey-out' the background using a transparent
 * image.
 */
 
 
 
    /**
     * Popup Details
     * Configure the popup styles using the following variables
     */
    var width = 250;
    var height = 225; 
    fontFamily = "sans-serif";
    fontSize = "3";
    fontColor = "#000000";
    vAlign = "center";
    popupText = '<div style="float: right;"><a href="#" onclick="hide(); showselects();" style="text-decoration: none;"><img src="/graphics/close.gif" style="border: none;" /></a></div><img src="/graphics/flash.gif" /><br /><br />You need <b>Flash Player 7</b> to preview this ringtone!<br /><br /><br />- <a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_BLANK" onclick="showselects(); hide();">Download Flash Player</a>';
    
    /**
     * Calculate Sizes
     * This function is used to calculate the size required by this script
     *
     * @return Array sizes - The size details
     */
    function calculateSizes()
    {
        var sizes = getPageSize();
        
        windowWidth = sizes[2];
        windowHeight = sizes[3];
        
        halfWindowWidth = windowWidth / 2;
        halfWindowHeight = windowHeight / 2;
        
        halfWidth = width / 2;
        halfHeight = height / 2;
        
        xOffset = halfWindowWidth - halfWidth;
        yOffset = halfWindowHeight - halfHeight;
        
        var details = new Array(height, width, xOffset, yOffset);
        return details;
    }
    
    
    
    /**
     * Make Popup
     * This fucntion is used to render the popup
     *
     * @param string link - The link to the preview ".wma" file
     */
    function makePopup(link)
    {
        var pageHeight = getPageSize();
        // Reference the <body> element
        var objBody = document.getElementsByTagName("body").item(0);        
        // Create a new <div> tag for the transparancy overlay
        var objOverlay = document.createElement("div");
        // Set the attributes of this new <div> tag
        objOverlay.setAttribute('id', 'overlay');
        objOverlay.style.position = 'absolute';
        objOverlay.style.zIndex = '100';
        // Set the properties of the overlay
        objOverlay.onclick = function () { hide(); return false; }
        objOverlay.style.display = 'none';
        objOverlay.style.top = '0px';
        objOverlay.style.left = '0px';
        objOverlay.style.width = '100%';
        objOverlay.style.height = pageHeight[1] +"px";//"2000px";
        objOverlay.style.display = 'inline';
        // Insert the transparency overlay as the first element inside the body
        objBody.insertBefore(objOverlay, objBody.firstChild);
        
        // Create the markup required to make the Popup
        var popup = '<div id="popup">'+popupText+'<br /><br />- <a href="'+link+'" onclick="showselects(); hide();">Download preview</a><p /> (to play in media player)<br /><br /></div>';
        // Create a new <div> tag for the popup
        var objPopupContainer = document.createElement("div");
        objPopupContainer.setAttribute('id', 'popupcont');
        // Insert the Popup before the transparency overlay layer
        objBody.insertBefore(objPopupContainer, objBody.lastChild);
        // Markup the popup
        document.getElementById('popupcont').innerHTML = popup;
        
        var sizes = calculateSizes();
        var pos = getWindowPos();
        var middle = pos[1]+sizes[0];
        
        // Sets the size and position of the popup
        var objPopup = document.getElementById('popup');
        objPopup.style.position = 'absolute';
        objPopup.style.left = sizes[2] +"px";
        objPopup.style.top = middle +"px";
        objPopup.style.width = sizes[1] +"px";
        objPopup.style.height = sizes[0] +"px";
        
    }
    
    
    
    /**
     * Hide
     * This function is used to hide both the popup and the transparency overlay
     */
    function hide()
    {
        // Get the elements which will be affected by the hide
        objOverlay = document.getElementById('overlay');
        objPopupContainer = document.getElementById('popupcont');
        // Hide elements
        objOverlay.style.display = 'none';
        objPopupContainer.innerHTML = '';
        // Disable keypress listener
        document.onkeypress = '';
    }

      
    
    function getWindowPos()
    {
        var x,y;
        if (self.pageYOffset) // all except Explorer
        {
        	x = self.pageXOffset;
        	y = self.pageYOffset;
        }
        else if (document.documentElement && document.documentElement.scrollTop)
        	// Explorer 6 Strict
        {
        	x = document.documentElement.scrollLeft;
        	y = document.documentElement.scrollTop;
        }
        else if (document.body) // all other Explorers
        {
        	x = document.body.scrollLeft;
        	y = document.body.scrollTop;
        }
        
        windowPos = new Array(x,y);
        return windowPos;
    }
    
    
    
    
    
    
    
    
    
    
    /**
     * Get Page Size
     * This function is used to get some useful page sizes, such as the resolution of
     * the user's monitor and the size of their browser window
     *
     * @return Array pageDetails - An array of different sizes
     */
    function getPageSize()
    {
        var xScroll, yScroll;
        if(window.innerHeight && window.scrollMaxY)
        {	
            xScroll = document.body.scrollWidth;
            yScroll = window.innerHeight + window.scrollMaxY;
        }
        // All but Explorer Mac
        else if(document.body.scrollHeight > document.body.offsetHeight)
        {
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        }
        // Explorer Mac... Would also work in Explorer 6 Strict, Mozilla and Safari
        else
        {
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
	
        var windowWidth, windowHeight;
        // All except Explorer
        if(self.innerHeight)
        {
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        }
        // Explorer 6 Strict Mode
        else if(document.documentElement && document.documentElement.clientHeight)
        {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        }
        // Other Explorers
        else if(document.body)
        {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }	
	
        // For small pages with total height less then height of the viewport
        if(yScroll < windowHeight)
        {
            pageHeight = windowHeight;
        }
        else
        { 
            pageHeight = yScroll;
        }

        // For small pages with total width less then width of the viewport
        if(xScroll < windowWidth)
        {	
            pageWidth = windowWidth;
        }
        else
        {
            pageWidth = xScroll;
        }
        
        pageDetails = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
        return pageDetails;
    }
    
     
    /**
     * Content Survey PopUp
     * This function simply creates the required popup
     * window for survey shack surveys
     *
     * @return void
     */
    function contentSurveyPopUp(link) {
        var winfeatures = "width=820,height=510,scrollbars=1,resizable=1,toolbar=0,location=0,menubar=0,status=1,directories=0";
        win = window.open(link, "", winfeatures);
    }
    
    
    

//-->