
//***************************************************************************************
// main functions
window.onload = function main(){  
        
        initFlash ();
        createLinks ();  
        adDisplay ();
     
}
	
//***************************************************************************************



function initFlash ()
{
    // initialize flash
    //var currPath = "www.gushers.com";
    //if (location.host == "q.gushers.com") { currPath = "q.gushers.com"} 

    var flashvars = {
           //hostingURL: "http://" + currPath + "/"
           hostingURL: ""
        };
    var params = {
            wmode: "transparent"
        };
    var SiteParams = {
            wmode: "nontransparent"
        };
    var attributes = false;
    
    var flashName = "main.swf";
   

    if (!(swfobject.hasFlashPlayerVersion("9.0.0"))) { 
            document.getElementById("flashError").style.display = "block"; 
        } 

    swfobject.embedSWF(flashName,"flashContent","100%", "100%", "9.0.0", false , flashvars, params, attributes);



}


function createLinks ()
{
    // create footer/misc links .... catch exception on site pages with no footer
    
    try {
        var footerLinks = document.getElementById("footer");
     
        footerLinks.getElementsByTagName("a").item(1).onclick = function(){
            new_win("http://www.generalmills.com/corporate/legal/legal.aspx",820,590); return false;
        }
        footerLinks.getElementsByTagName("a").item(2).onclick = function(){
            new_win("privacy.aspx",450,500); return false;
        }
        footerLinks.getElementsByTagName("a").item(3).onclick = function(){
            new_win("http://consumercontacts.generalmills.com/ConsolidatedContact.aspx?page=http://www.generalmills.com/corporate",520,500); return false;
        }
    } 
    catch(e){}
    
   
}


function adDisplay ()
{
    // show-hide add .. catch where footer isn't displayed
    try {
        document.getElementById("ad-spot").onmouseover = function() {
              document.getElementById("ad-pop").style.display = "inline"
        }
        document.getElementById("ad-spot").onmouseout = function() {
              document.getElementById("ad-pop").style.display = "none"
        }
    }
    catch(e){}
}


function full_win(url)
{
    window.open(url,"mywin");
}



function new_win(url, width, height)
{
    window.open(url,"mywin","width=" + width + ",height=" + height + "toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,screenX=160,left=150,screenY=150,top=150");
}


function getParams (variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
        return pair[1];
    }
  } 
  return 1;
}






