
/**
 * Popup the Game Park 
 *
 * Porting and trying to duplicate the 'open_popup' function
 * This should be updated if the Game URL or window name changes
 */
function popup_game_park() {
	var url = '/games/park';
	var name = 'game';
	window.open(url, name, "status = 1, height = 600, width = 980, resizable = 0" )
}
        // Game Popup Code
        function open_popup(url, name) {
                window.open( url, name, "status = 1, height = 600, width = 980, resizable = 0" )
        }
	
	// Use this for png images only. For other image formats, Dojo AutoRoll can be used
	function lightup(img, path) {
        img.src = path + "_ov.png";
        }
        function turnoff(img, path){
        img.src = path + ".png";
        }

	// Use to set character limit for textfields
        function limit_chars(id, limit) {
                if (document.getElementById(id).value.length > limit) {
                document.getElementById(id).value = document.getElementById(id).value.substring(0, limit);
                }
        }

	// Function to toggle Element display. 
	// el = id of element to show/hide.
	// toggle_img_id = id of image to be toggled. (optional)
	
	function toggle_content(el, toggle_img_id) {
                var elem = document.getElementById(el);
				if (elem.style.display.length == 0) { 
					elem.style.display = "none";
				}
                if (elem) {
                        (elem.style.display == "none") ? elem.style.display="block" : elem.style.display="none";
                }
		
		if (toggle_img_id) {
		var new_class = new String();
		var toggle_img = document.getElementById(toggle_img_id);
		new_class = toggle_img.className;
		(!(toggle_img.className.indexOf("off") == -1)) ? new_class = new_class.replace(/off/, "on") :  new_class = new_class.replace(/on/, "off");
		toggle_img.className = new_class;
		}
	}

var curleft = 0;
var curtop = 0;
  // Used to find out the Mouse XY
  function findPosX(obj)
  {

        curleft = 0;
        curtop = 0;


    if(obj.offsetParent)
        while(1)
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {

    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

  	// Mamabar JS
   	function brandMamabarMoreOver(el) { 
   		el.className = "brand-mamabar-more-link brand-mamabar-more-link-hover"; 
	}
   	
	function brandMamabarMoreOut(el) { 
		el.className = "brand-mamabar-more-link"; 
	}
	
	// get proper sections for DART Ads
	function getAdSections() {
		var retVal = window.location.pathname;
		var pageSections = window.location.pathname.split("/");
		if (!pageSections[1].length || pageSections[1].indexOf("index") != -1) {
				retVal = "/_hp";
		}else if (pageSections.length ==2 && pageSections[1].indexOf(".") == -1) {
			retVal += "/_mn";
		} else if (pageSections[pageSections.length-1].indexOf(".") == -1 && retVal.charAt(retVal.length-1) != "/" ){
			retVal += "/index";
		}
		return retVal;
	}

