var currentProductnaviOnImg = "";

/**
* Opens popup.
*/
var popupWin;
function openPopup(urli, w, h){
  //alert("openPopup(): urli: " +urli);
  popupWin=open(urli,"11","toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" +w +",height=" +h +"");
  if (!popupWin.closed) {
    popupWin.blur();
    popupWin.focus();
  }
}


/**
* Opens url in current frame.
*/
function goToUrl(urli) {
  location.href = urli;
}


var rovioEditorWin;
function openRovioEditor(id1, id2) {
  var rovioEditorUrl = websiteUrl +"?action=rovioeditor&id1=" +id1 +"&id2=" +id2;
  var w=750;
  var h=850;
  rovioEditorWin = open(rovioEditorUrl,"rovioeditor", "toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" +w +",height=" +h +"");
  if (!rovioEditorWin.closed) {
    rovioEditorWin.blur();
    rovioEditorWin.focus();
  }

}





/**
* THis function set the height of the div with given id.
* @param divId  The id of the div whose height will be set as String.
* @param screenHeight  The heigh of browser window in pixels.
* @param deltaHeight  The height of the site layout
*/

function setDH(divId, screenHeight, deltaHeight) {
  
   //alert("setDH(): screenHeight: " +screenHeight);
  
   var divs,contDivs,maxHeight,divHeight,d; 

   // get all <div> elements in the document 

   divs=document.getElementsByTagName('div'); 

   contDivs=[]; 

   // initialize maximum height value 

   maxHeight=0; 

   // iterate over all <div> elements in the document 

   for(var i=0;i<divs.length;i++){ 

       d=divs[i]; 
       
   
       if(d.id == divId) {
       if(screenHeight) {
           d.style.height = (screenHeight - deltaHeight); 
         }
       }
   }
     
} // end setDH()


/**
* Utility function to get the browser window width/height.
* @param size  String 'w' or 'h' (width/height) that tells which 
*              mesure to return.
*/

function getWindowSize(size)
{
    var bIE = (document.all) ? true : false;
    if (size == 'w')
        return ((bIE) ? document.body.offsetWidth : window.innerWidth);
    else if (size == 'h')
        return ((bIE) ? document.body.offsetHeight : window.innerHeight);
}


/**
* Utility function to dig proerty values from given set of objects.
* Takes in an array ob objects and an array on property names.
* Then digs out every property from every object and returns a formatted 
* result string.
*/
function digProperties(testElements, testProperties) {

  var results = ''; 
  
  for (var i = 0; i < testElements.length; i++) { 
     var element = testElements[i]; 
     results += 'element ' + element.tagName + ':\r\n'; 
     for (var j = 0; j < testProperties.length; j++) { 
       var property = testProperties[j]; 
       results += '  ' + property + ': ' + getComputedStyleValue(element, 
  property) + '\r\n'; 
     } 
     results += '\r\n'; 
  
  } 

  return results;
} 

