// version 1.2
//Vudu_nav.js is used to render the site navbar and page outer contents.


//COOKIE FUNCTIONS USED FOR SAVING THE CART STATE
function VuduCookie() {
	this.expires = 7;
	if (document.cookie.length) { this.cookies = ' ' + document.cookie; }
}

VuduCookie.prototype.deleteCookie = function ( key ) {
	
	if(this.getCookie(key))	{
		document.cookie = 
			key+ "=;path=/;domain=" + ( VM.domain ? "vudu.com " : VM.cookiedomain ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
};

VuduCookie.prototype.setCookieWithDate = function (key, value, exp) {

	var d = new Date();
	var m = 0;

	if (exp == "day") {
		m = d.getDate();
	    d.setDate(m+1);
	} else if (exp == "minute") {
		m = d.getTime();
	    d.setTime(m + 60000);
	} else {
		m = d.getMonth();
	    d.setMonth(m+1);
	}

    if (!document.cookie || (document.cookie == "") || !document.cookie.length) {
        var t = key + "=" + escape(value) + "; expires=" + d.toGMTString() + "; domain=" + (VM.domain ? "vudu.com " : VM.cookiedomain) + "; path=/";
       // alert(t);
        document.cookie = t;
        //alert(document.cookie);
        this.cookies = ' ' + document.cookie;
    } else {
        var t = key + "=" + escape(value) + "; expires=" + d.toGMTString() + "; domain=" + (VM.domain ? "vudu.com " : VM.cookiedomain) + "; path=/";
       // alert(t);
        document.cookie = t;
       // alert(document.cookie);
	    this.cookies = ' ' + document.cookie;
    }
}

VuduCookie.prototype.setCookie = function (key, value) {
	this.setCookieWithDate(key, value, "month");
}

VuduCookie.prototype.getCookie = function (key) {
	if (this.cookies) {
		var start = this.cookies.indexOf(' ' + key + '=');
		if (start == -1) { return null; }
		var end = this.cookies.indexOf(";", start);
		if (end == -1) { end = this.cookies.length; }
		end -= start;
		var cookie = this.cookies.substr(start,end);
		return unescape(cookie.substr(cookie.indexOf('=') + 1, cookie.length - cookie.indexOf('=') + 1));
	}
	else { return null; }
}

VuduCookie.prototype.testCookie = function () {

  //var expDate = new Date();
  //valid one minute
  //expDate.setTime( expDate.getTime() + ( 60 * 1000 ) );
 var str = document.location.href;

 if ((str.indexOf(".vudu.com") == -1) || (str.indexOf(".marquee.net") == -1)) return;
  if (str.substring(0,5) == "file:") VM.domain = 0;
  this.setCookieWithDate( "testCookie", "OK","minute" );
  var testing = this.getCookie( "testCookie" );
 // alert(testing);
  if ( testing == "OK" )
  {
	  if (str.indexOf("nocookies.html")!= -1) {
		    //document.location.href = VM.local_base;
			var l = document.location.href;
			if (l.indexOf("forward=") != -1) {
				document.location.href = l.substring(l.indexOf("forward=")+8, l.length);
			} else document.location.href = VM.local_base;
	  }
	  return true;
  }
  else
  {
	 // alert("TELL KEITH YOU SAW [" + testing + "]");
	 if (str.indexOf("nocookies.html")== -1) document.location.href = VM.local_base + "nocookies.html?forward="+document.location.href;
    //document.location.href = VM.local_base + "nocookies.html";
  }
}


var CookieMonster = new VuduCookie();

function VUDU_parse_arg(val)
{
    var loc = document.location.href;

	if (loc.indexOf(val + "=") != -1) {
		var nav1b = loc.indexOf("&", loc.indexOf(val + "="));
		if (nav1b == -1) nav1b = loc.length;
		return unescape(loc.substring(loc.indexOf(val + "=") + val.length + 1, nav1b));
	} else return 0;
}


function VUDU_goto(val)
{
    if (val == "community") document.location.href = VM.local_base + "myvudu_community.html";
    else if (val == "reviews") document.location.href = VM.local_base + "product_reviews.html";
    else if (val == "faqhome") document.location.href = VM.support;
    else if (val == "home") document.location.href = VM.home;
    return false;
}

function VUDU_login()
{

	if (!VM.ofbiz) {
		VM.updateLogin(0);
		document.location.href="login.html";
	    //else "document.location.href=\"/buynow/control/logout\"";
    } else {
		if (VM.loggedin) eval(VM.logout);//document.location.href = VM.login;
		else eval(VM.login);//document.location.href = VM.logout;
	}
}

function VUDU_highlight(t, lit)
{
	var hi = t.className.substring(t.className.length-1, t.className.length);
	var cn = ((hi == 'h') ? t.className.substring(0, t.className.length-1) : t.className);

	t.className = lit ? cn + "h" : cn;
	//t.className = lit ? VM.buttonclass + "h" : VM.buttonclass;
}

function VUDU_highlight_class(t, lit, bclass)
{
	t.className = lit ? bclass + "h" : bclass;
}

function VUDU_showSub(t, ext, showsub, dotimer)
{
	if (ext != 0) t.className= ext;

	if (VM) {
		if (showsub && VM.showSub) {
			if (showsub == "zero") VM.showSub(0);
			else VM.showSub(showsub);
		}
		if (dotimer && VM.doTimer) {
			VM.doTimer(0);
		}
	}
}
function VUDU_alphaImage(id, imgname, x, y, w, h, disp)
{
	 var isIE5 = (document.all && document.getElementById) ? true : false;
	 var str = imgname.substring(0, imgname.indexOf("."));
	 if (isIE5 && (navigator.appVersion.indexOf("MSIE 7.0") == -1)) {
		 return "<img id=" + id + " src='" + VM.base + "spacer.png' width=" + w + " height=" + h + " ihspace=8 ivspace=8 style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgname + "', sizingMethod=scale);position:absolute;top:" + y + ";left:" + x + ";" + (disp ? "display:" + disp + ";" : "") + "\">";

     } else {
	     return "<img id=" + id + " src='" + imgname + "' width=" + w + " height=" + h + " ihspace=8 ivspace=8 style='position:absolute;top:" + y + ";left:" + x + ";" + (disp ? "display:" + disp + ";" : "") + ";'>";
     }
}

function VUDU_findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function VUDUButton(id, title, action, icon, state)
{
	this.id = id;
	this.title = title;
	this.action = action;
	this.icon = icon;
	this.state = state;
	VM.buttons[VM.buttons.length] = this;
}

function URLEncode(string) {

    string = string.replace(/\r\n/g,"\n");
    var utftext = "";

    for (var n = 0; n < string.length; n++) {

        var c = string.charCodeAt(n);

        if (c < 128) {
            utftext += String.fromCharCode(c);
        }
        else if((c > 127) && (c < 2048)) {
            utftext += String.fromCharCode((c >> 6) | 192);
            utftext += String.fromCharCode((c & 63) | 128);
        }
        else {
            utftext += String.fromCharCode((c >> 12) | 224);
            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
            utftext += String.fromCharCode((c & 63) | 128);
        }
    }
    return escape(utftext);
}

//VUDU MANAGER OBJECT CONTROLS THE SITE WIDE VARIABLES AND MANAGES THE MENU HEIRARCHY;
function VUDUManager()
{
	this.timer = 0;
	this.current_sub = 0;
	this.current_page = 0;
	this.active_sub = 0;
	this.button_count = 0;
	this.margin_left = 58;
	this.ofbiz = 1;
	this.inner_width = 800;
	this.turbo_inset = 0;
	this.inner_top = 10;
	this.inner_inset = 40;
	this.secure = 0;
	this.branch = 0;
	this.domain = 1;
	this.guarantee = 0;
	this.buttonclass = "vudu_button_130";
	this.faq = 0;
	this.alien = 0;
	this.application = 0;
	this.before_nav = 0;
    this.step_icon = 0;


	var str = document.location.href;
	this.location = str;

	if (str.indexOf("application=support") != -1) {
			this.application = "support";
	} else if (str.indexOf("application=faq") != -1) {
		this.application = "faq";
	} else if (str.indexOf("application=bugzilla") != -1) {
		this.application = "bugzilla";
	} else this.application = 0;


    this.support_url = CookieMonster.getCookie("VUDU_SUPPORT_URL");
	if ((this.support_url == null) || (this.support_url == -1)) {
	    this.support_url = 0;
	}


    this.forums_url = CookieMonster.getCookie("VUDU_FORUMS_URL");
	if ((this.forums_url == null) || (this.forums_url == -1)) {
	    this.forums_url = 0;
	}
	//if ((this.application == "support") && ((this.location.indexOf("vudu_documentation") != -1) || (this.location.indexOf("termsofservice") != -1) || (this.location.indexOf("privacypolicy") != -1))) {
		//this.forums_url = 0;
	    //this.support_url = 0;
	//	this.alien = 1;
   // }

    this.faq_url = CookieMonster.getCookie("VUDU_FAQ_URL");
	if ((this.faq_url == null) || (this.faq_url == -1)) {
	    this.faq_url = 0;
	}
	if (((this.application == "support") || (this.application == "faq")) && ((this.location.indexOf("vudu_documentation") != -1) || (this.location.indexOf("termsofservice") != -1) || (this.location.indexOf("privacypolicy") != -1) || (this.location.indexOf("aboutus_background") != -1) || (this.location.indexOf("aboutus_contactus") != -1) || (this.location.indexOf("aboutus_press") != -1) || (this.location.indexOf("aboutus_jobs") != -1) || (this.location.indexOf("aboutus_resellerhome") != -1))) {


		//this.faq_url = 0;
	    //this.support_url = 0;
		this.alien = 1;
    }

    this.site_url = CookieMonster.getCookie("VUDU_SITE_URL");
	if ((this.site_url == null) || (this.site_url == -1)) {
	    this.site_url = 0;
	}




	if (str.substring(0,5) == "https") this.secure = 1;

	if (str.indexOf(".qa.") != -1) {
		this.branch = 1;
	} else if (str.indexOf(".dev.") != -1) {
		this.branch = 2;
	} else if (str.indexOf("gui/cine") != -1) {
		this.branch = 3;
	} else if (str.indexOf("w3.vudu.com") != -1) {
		this.branch = 4;
	} else if (str.indexOf(".marquee.net") != -1) {
		this.branch = 2;
	} else if (str.indexOf("staging.vudu") != -1) {
		this.branch = 7;
	} 
	// if user if on my.vudu and came from staging - then set as staging
	else if(str.indexOf("my.vudu") != -1 && this.site_url && this.site_url.indexOf("staging.vudu") != -1)	{
		this.branch = 7;
	} else if (str.indexOf("jcoyne-nb") != -1) {
		this.branch = 5;
	}  else if (str.indexOf("localhost") != -1) {
		this.branch = 2;
	}

    if (!this.branch) { // LIVE PRODUCTION http://www.vudu.com

    	this.login_url = "https://myvudu.vudu.com/MyLogin.html";
    	this.logout_url = "https://www.vudu.com/logout.html";
    	this.myAccount = "https://myvudu.vudu.com/MyAccount.html";
    	this.myDevice  = "https://myvudu.vudu.com/MyDevice.html";
    	
		this.ofbiz_base = "https://my.vudu.com/";
		this.local_base= "http://www.vudu.com/";
		this.home = "http://www.vudu.com";
		this.hometheater = "http://hometheater.vudu.com";
		this.base = "http" + (this.secure ? "s" : "") + "://images.vudu.com/v4/";
		this.cookiedomain = "vudu.com";
		this.activationLink = "https://myvudu.vudu.com/MyActivation.html";
		this.activationCode = "https://myvudu.vudu.com/MyActivation.html";
        this.google_maps_key = "ABQIAAAAGSvOO5G0eVLqkpMbxEv_LBSMhScPdQwffUhfD_VWsqUxFWDKohQioHLGnURCIKhtqTCNrjy0V0sCdg";

	} else if (this.branch == 1) {  // QA on http://www.qa.marquee.net
		
		var www = "www";
		
		// for qa base
		if(str.indexOf("www3.") != -1  )	{
			www = "www3";
		}
		// if in ofbiz and coming from www3
		else if( this.site_url && this.site_url.indexOf("www3.") != -1)	{
			www = "www3";
		}
		
		this.login_url = "https://myvudu.qa.marquee.net/MyLogin.html";
		this.logout_url = "https://www.qa.marquee.net/logout.html";
		this.myAccount = "https://myvudu.qa.marquee.net/MyAccount.html";
    	this.myDevice  = "https://myvudu.qa.marquee.net/MyDevice.html";

    	this.ofbiz_base = "https://my.qa.marquee.net/";
		this.local_base = "http://"+www+".qa.marquee.net/";
		this.home = "http://"+www+".qa.marquee.net";
		this.hometheater = "http://hometheater.qa.marquee.net";
		this.base = "http" + (this.secure ? "s" : "") + "://images.qa.marquee.net/";
		this.domain = 0;
		this.cookiedomain = "qa.marquee.net";
		this.activationLink = "https://myvudu.qa.marquee.net/MyActivation.html";
		this.activationCode = "https://myvudu.qa.marquee.net/MyActivation.html";
        this.google_maps_key = "ABQIAAAAGSvOO5G0eVLqkpMbxEv_LBQfuYgFt79cd1f-eY8hnMOYEjKBYhTi_IH3w-0g9BxU_vI4yDUh9m-f0A";
    } else if (this.branch == 2) {  // DEV on http://www.dev.marquee.net
		
		var www = "www";
		
		// for dev base
		if(str.indexOf("www3.") != -1 )	{
			www = "www3";
		}
		// if in ofbiz and coming from www3
		else if( this.site_url && this.site_url.indexOf("www3.") != -1)	{
			www = "www3";
		}
		
		this.login_url = "https://myvudu.dev.marquee.net/MyLogin.html";
		this.logout_url = "https://www.dev.marquee.net/logout.html";
		this.myAccount = "https://myvudu.dev.marquee.net/MyAccount.html";
    	this.myDevice  = "https://myvudu.dev.marquee.net/MyDevice.html";
    	
		this.ofbiz_base = "https://my.dev.marquee.net/";
		this.local_base = "http://"+www+".dev.marquee.net/";
		this.home = "http://"+www+".dev.marquee.net/";
		this.hometheater = "http://hometheater.dev.marquee.net";
		this.base = "http" + (this.secure ? "s" : "") + "://images.dev.marquee.net/";
		this.domain = 0;
		this.cookiedomain = "dev.marquee.net";
		this.activationLink = "https://myvudu.dev.marquee.net/MyActivation.html";
		this.activationCode = "https://myvudu.dev.marquee.net/MyActivation.html";
        this.google_maps_key = "ABQIAAAAGSvOO5G0eVLqkpMbxEv_LBSzilzSyXGVwwEyxMfHcXhc-iunfBSym8dA_tiuf0OmxVtZcu0llzLXqQ";
    } else if (this.branch == 4) {  // SJDC BRANCH

    	this.login_url = "https://myvudu.vudu.com/MyLogin.html";
    	this.logout_url = "https://www.vudu.com/logout.html";
		this.ofbiz_base = "https://my.vudu.com/";
		this.local_base = "http://w3.vudu.com/";
		this.home = "http://w3.vudu.com/";
		this.base = "http" + (this.secure ? "s" : "") + "://i3.vudu.com/";
		this.domain = 0;
		this.cookiedomain = "w3.vudu.com"
		this.activationLink = "https://activate.vudu.com/FEBoss/faces/createAccount.jsp";
		this.activationCode = "https://activate.vudu.com/FEBoss/faces/enterActivationCode.jsp";
    this.google_maps_key = "ABQIAAAAGSvOO5G0eVLqkpMbxEv_LBTV0Ms4tKvo6G1kh9nuOx7Ez5pnmxQB-MEr_b7ARkvPyfk8oHPtf3DF5A";

    }  else if (this.branch == 5) { // JOHN'S TESTING BRANCH
    		this.ofbiz_base = "https://ofbiz.qa.marquee.net:8443/";
    		this.local_base = "http://jcoyne-nb/";
    		this.home = "http://jcoyne-nb";
    		this.hometheater = "http://jcoyne-nb/xl"
    		this.base = "http://jcoyne-nb/static_images/";
    		this.domain = 0;
			this.activationLink = "https://myvudu.dev.marquee.net/MyActivation.html";
			this.activationCode = "https://myvudu.dev.marquee.net/MyActivation.html";
    		this.cookiedomain = "jcoyne-nb"

    } else if (this.branch == 6) { // Vinod's TESTING BRANCH
    		this.ofbiz_base = "https://localhost:8443/";
    		this.local_base = "https://localhost:8443/buynow/static/";
    		this.home = "https://localhost:8443/";
    		this.base = "https://localhost:8443/buynow/static/";
    		this.domain = 0;
    		this.cookiedomain = "";
			this.activationLink = "https://activate.dev.marquee.net/FEBoss/faces/createAccount.jsp";
			this.activationCode = "https://activate.dev.marquee.net/FEBoss/faces/enterActivationCode.jsp";
            this.google_maps_key = "ABQIAAAAGSvOO5G0eVLqkpMbxEv_LBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSywIYCG-uFoyJ3gUfvoqdhgo7IRw";

    } else if (this.branch == 7) { // Staging domain
    	
    	this.ofbiz_base = "https://my.vudu.com/";
		this.local_base= "http://www.staging.vudu.com/";
		this.home = "http://www.staging.vudu.com";
		this.hometheater = "http://hometheater.staging.vudu.com";
		this.base = "http" + (this.secure ? "s" : "") + "://images.vudu.com/v4/";
		this.cookiedomain = "vudu.com";
		this.activationLink = "https://myvudu.vudu.com/MyActivation.html";
		this.activationCode = "https://myvudu.vudu.com/MyActivation.html";
        this.google_maps_key = "ABQIAAAAAKr9Hu_DMBlALLHh48SvKRTYrVewAmD6l0QNaJzMTjjER3k9OBQ0GaSuqf82mKQk_WGwU_qwJBHGNg";
    } else {  //KEITHS TESTING

		this.ofbiz_base = "https://ofapp1.dev.marquee.net:8443/";
		this.local_base = "http://gui/cine/site/vudu_root/";
		this.home = "http://gui/cine/site/vudu_root/";
		this.base = "http://gui/cine/site/vudu_root/static_images/";
		this.domain = 0;
		this.activationLink = "https://activate.dev.marquee.net/FEBoss/faces/createAccount.jsp";
		this.activationCode = "https://activate.dev.marquee.net/FEBoss/faces/enterActivationCode.jsp";
		this.cookiedomain = "gui"

	}
    
    // *** IF OFBIZ page is requested *** //
    //	   redirect to Director Login instead 		//
    if( str.indexOf('buynow/control') != -1 )	{
    	document.location.href = this.login_url;
    }

    this.forums = ((this.forums_url && (this.forums_url.length > 5)) ? this.forums_url : "http://www.vudu.com/forums");
    this.faq = ((this.faq_url && (this.faq_url.length > 5)) ? this.faq_url : "http://www.vudu.com/support");
	this.bugzilla = 0;
	this.support = ((this.support_url && (this.support_url.length > 5)) ? this.support_url : "http://www.vudu.com/support");

    this.show_cart = 1;

	//LOCAL TESTING

	this.message = 0;
	this.reel = 0;
	this.reel_status = 0;
	this.error = 0;
	this.outer_inset = 20;
	this.active = 0;
	this.margin_right = 40;
	this.image = "buynow";
	//this.imageurl = "document.location.href=\"" + this.local_base + "product_bandwidth.html\"";
	this.imageurl = "document.location.href=\"https://my.vudu.com/buynow/\"";
	this.nav_hints = new Array("faqhome", "document.location.href='" + this.support + "'", "forums", "document.location.href='" + this.forums + "'", "bugzilla", "document.location.href='" + this.bugzilla + "'","contact", "document.location.href='" + this.support + "/contact.php'","glossary", "document.location.href='" + this.support + "/glossary.php'","home","VUDU_goto('home')");
	this.white = 0;
	this.logo = 0;
	this.management_index = 0;
	this.cart = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/showcart\"" : "document.location.href=\"" + this.local_base + "buy.html\"";
	this.loggedin = 0;
	this.cart_items = 0;
	this.login = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/checkLogin\"" : "document.location.href=\"" + this.local_base + "login.html\"";
	this.logout = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/logout\"" : "document.location.href=\"" + this.local_base + "login.html\"";
	this.footer = new Array();
	this.buttons = new Array();
	this.nav = new VUDU_nav("root");
	this.loaderbuilder = 1;
	this.nocart = 0;
}

VUDUManager.prototype.addButton = function (id, title, action, icon, state)
{
	var c = 0;
	for (var a = 0; a < this.buttons.length; a++) {
	    if (this.buttons[a].id == id) {
			c = this.buttons[a].id;
			break;
		}
	}
	if (c) {
		c.title = title;
		c.action = action;
		c.icon = icon;
		c.state = state;
	} else {
        this.buttons[this.buttons.length] = new VUDUButton(id, title, action, icon, state);
	}
}

VUDUManager.prototype.getButtonClassFor = function (val, icon)
{
	if ((icon != "add") && (icon != "continue")) icon = 0;
	if (!val || !val.length) return "vudu_button_110";

	var len = val.length;
	if (icon) len += 3;

	if (len < 8) return "vudu_button" + (icon ? "_" + icon : "") + "_90";
	else if (len < 11) return "vudu_button" + (icon ? "_" + icon : "") + "_110";
	else if (len < 14) return "vudu_button" + (icon ? "_" + icon : "") + "_130";
	else if (len < 17) return "vudu_button" + (icon ? "_" + icon : "") + "_150";
	else  return "vudu_button" + (icon ? "_" + icon : "") + "_170";

}


VUDUManager.prototype.setSupport = function ()
{
	//this.base ="http://images.vudu.com/v4/";
	if (!this.alien) this.inner_width = 860;
	if (!this.alien) this.inner_inset = 10;
	if (!this.alien) this.turbo_inset = 30;
	if (!this.alien) this.margin_left = 0;
	if (!this.alien) this.margin_right = 0;
	this.image = "bandwidth1";
	if (this.site_url) this.home = this.site_url;
	this.logo = "support";
	if (!this.alien) this.margin_right = 0;

	if (this.location.indexOf("http://supports.vudu.com") != -1) CookieMonster.setCookie("VUDU_FORUMS_URL", document.location.href);
	CookieMonster.setCookie("VUDU_SUPPORT_URL", document.location.href);
	this.addMenu("faqhome:document.location.href='http://www.vudu.com/support'");
	this.addMenu("forums");
	//VM.addMenu("bugzilla");
	this.addMenu("documentation:document.location.href='http://www.vudu.com/vudu_documentation.html?application=support'");
	this.addMenu("glossary:document.location.href='http://supports.vudu.com/glossary.php'");
	this.addMenu("contact:document.location.href='"+this.ofbiz_base + "buynow/control/support'");
	this.addFooter("About Us","http://www.vudu.com/aboutus_background.html?application=support","Contact Us","http://www.vudu.com/aboutus_contactus.html?application=support","Press","http://www.vudu.com/aboutus_press.html?application=support","Terms of Service","http://www.vudu.com/termsofservice.html?application=support","Privacy Policy","privacypolicy.html?application=support" );

	if (!this.alien) this.white = 1;
	this.show_cart = 0;

}

VUDUManager.prototype.setFAQ = function ()
{
	if (!this.alien) this.inner_width = 860;
	if (!this.alien) this.margin_left = 30;
	if (!this.alien) this.inner_inset= 10;
	if (this.site_url) this.home = this.site_url;
	if (!this.alien) this.turbo_inset = 30;
	if (this.location.indexOf("http://forum.vudu.com") != -1) CookieMonster.setCookie("VUDU_FAQ_URL", document.location.href);
	CookieMonster.setCookie("VUDU_SUPPORT_URL", document.location.href);
	this.logo = "support";
	if (!this.alien) this.margin_right = 30;
	this.addMenu("faqhome:document.location.href='http://www.vudu.com/support'");
	this.addMenu("forums");
	//VM.addMenu("bugzilla");
	this.addMenu("documentation:document.location.href='http://www.vudu.com/vudu_documentation.html?application=faq'");
	this.addMenu("glossary:document.location.href='http://supports.vudu.com/glossary.php'");
	this.addMenu("contact:document.location.href='"+this.ofbiz_base + "buynow/control/support'");
	this.addFooter("About Us","http://www.vudu.com/aboutus_background.html","Contact Us","http://www.vudu.com/aboutus_contactus.html?application=faq","Press","http://www.vudu.com/aboutus_press.html?application=faq","Terms of Service","http://www.vudu.com/termsofservice.html?application=faq","Privacy Policy","privacypolicy.html?application=faq");

	if (!this.alien) this.white = 1;
	this.show_cart = 0;
}


VUDUManager.prototype.setOfbiz = function (val)
{
	this.ofbiz = val;
	this.cart = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/showcart\"" : "document.location.href=\"" + this.local_base + "buy.html\"";
	this.login = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/checkLogin\"" : "document.location.href=\"" + this.local_base + "login.html\"";
	this.logout = this.ofbiz ? "document.location.href=\"" + this.ofbiz_base + "buynow/control/logout\"" : "document.location.href=\"" + this.local_base + "login.html\"";
	this.imageurl = "document.location.href=\"" + this.local_base + "product_bandwidth.html\"";


}

VUDUManager.prototype.addMenu = function ()
{
	if (!arguments.length) return;
	var m = this.nav.addSub(arguments[0]);
	for (var a = 1; a < arguments.length; a++) {
		m.addSub(arguments[a]);
	}
}

VUDUManager.prototype.addFooter = function ()
{
	if (!arguments.length) return;
	for (var a = 0; a < arguments.length; a++) {
		this.footer[this.footer.length] = arguments[a];
	}
}

VUDUManager.prototype.showSub = function (t)
{
	if (this.timer) clearTimeout(this.timer);
	//alert(t + " " + this.current_sub);
	if (t && this.current_sub && (this.current_sub != t)) {
		if (f = document.getElementById("navbar_" + this.current_sub)) {
			f.style.display='none';
		}
	}
	if (t && (f = document.getElementById("navbar_" + t))) {
	    f.style.display='block';
	    this.current_sub = t;
    }
}

VUDUManager.prototype.doTimer = function ()
{
	if (this.timer) clearTimeout(this.timer);
	this.timer = setTimeout("VM.showSub('" + this.current_page + "')",1000);
}



VUDUManager.prototype.drawFooter = function ()
{
	var ss = "<div class=vudu_footer>";
	var cnt = 0;
	for (var a = 0; a < this.footer.length; a+=2) {

        if (cnt) ss += " &nbsp;|&nbsp;  ";
		ss +=  "<a href=\"" + this.footer[a+1] + "\">" + this.footer[a] + "</a>" ;
		cnt++;
	}
	
	ss += "</div>\n\n";
	
	var rr = "<div class=vudu_footer>";
	var cnt = 0;
	for (var a = 0; a < this.footer.length; a+=2) {
	
	if (cnt) rr += " &nbsp;|&nbsp;  ";
		rr +=  "<a href=\"" + this.footer[a+1] + "\">" + this.footer[a] + "</a>" ;
		cnt++;
		}
    
	rr += "</div>\n\n";
	rr += "<script type=\"text/javascript\" language=\"javascript\">";
		rr += "var loader = new YAHOO.util.YUILoader({";
		if(this.ofbiz)  {
			rr += "base: \"https://ajax.googleapis.com/ajax/libs/yui/2.7.0/build/\",";  
            rr += "filter: \"MIN\",";
			rr += "allowRollup: true,";
			rr += "combine: false,";
		}
		rr += "require: [\"dom\", \"datasource\" , \"animation\" ],";
		rr += "loadOptional: true,";
		rr += "onSuccess: function() {";
		rr += "var menu = new VuduMenu('vudu-menu');";
		rr += "menu.render();";
		rr += "}";
		rr += "});";
		rr += "loader.insert();";
	rr += "</script>";
	
	
	if (this.loaderbuilder == 1) {return rr;}
	else {return ss;};

}

VUDUManager.prototype.hasSub = function ()
{
	for (var a = 0; a < this.nav.subnav.length; a++) {
		if (this.nav.subnav[a].subnav.length) return 1;
	}
	return 0;

}

VUDUManager.prototype.doReel = function (val, x, y, op, obj)
{
	if (!VM.reel_status || (val < -1)) {
		if (VM.reel) clearTimeout(VM.reel);
		VM.reel = 0;
		if (f = document.getElementById("status_reel")) f.style.display = "none";
	} else {
		if (val >= 32) val = 0;
		if (f = document.getElementById("status_reel")) {
            w=28;
            h=20;
			f.innerHTML = "<div style='position:relative;overflow:hidden;width:28;height:20;top:0;left:0;'>" + VUDU_alphaImage("status_image", VM.base + "reel_28c.png", -28*((val == -1) ? 0 : val),0, 896, 20, 0) + "</div>";
			if (val == -1) {
				if (obj) {
					var pos = VUDU_findPos(obj);
					x = pos[0] + x;
					y = pos[1] + y;
				}
				val++;
				f.style.top = y;
				f.style.left = x;
				f.style.opacity = .8;
				f.style.display = "block";
			}
		}
		VM.reel = setTimeout("VM.doReel(" + (val+1.0) + ",0,0,0,0);",50);
	}
}


VUDUManager.prototype.initMenu = function ()
{
	if (this.application == "support") {
			this.setSupport();
			//this.margin_left = 88;
			//this.white = 0;
			return;
	} else if (this.application == "faq") {
		this.setFAQ();
		//this.margin_left = 88;
		//this.white = 0;
		return;
	} else if (this.application == "bugzilla") {
		this.setBugzilla();
		//this.margin_left = 88;
		//this.white = 0;
		return;
	}
	if (!this.nav.subnav.length) {
		var str = document.location.href;
		var transfer = 1;
		if (str.indexOf("/buynow/") != -1) {
			transfer = 0;
			str = str.substring(str.indexOf("/buynow/"), str.length);
			if (str == "/buynow/control/showcart") transfer = 1;
			else if (str == "/buynow/") transfer = 1;
			else if (str == "/buynow/control/checkLogin") transfer = 1;
			else if (str == "/buynow/control/viewprofile") transfer = 1;

		}
		if (transfer) CookieMonster.setCookie("VUDU_SITE_URL",document.location.href);
		this.addMenu("home");
		if (this.ofbiz) {
		    //this.addMenu("product","overview","testme:document.location.href='" + this.local_base + "product_bandwidth.html'","movies","specs","faq","reviews");
		    //this.addMenu("product","overview","testme:document.location.href='http://speedtest.vudu.com'","movies","specs","faq","reviews");
		    this.addMenu("product","overview","vudu","vudu_xl_home_theater:document.location.href='"+this.hometheater+"'","wireless","reviews","testimonials","faq");
		    // this.addMenu("product","overview","testme:document.location.href='http://speedtest.vudu.com'","specs","faq","reviews");
		    var site_http = "http" + this.ofbiz_base.substring(5,this.ofbiz_base.length);
			//this.addMenu("buy:document.location.href='" + this.ofbiz_base + "buynow'");
			//this.addMenu("buy","order:document.location.href='" + this.ofbiz_base + "buynow'","wheretobuy");
		    this.addMenu("movies:document.location.href='" + this.local_base + "movies/'");
			this.addMenu("buy","orderfromvudu:document.location.href='" + this.ofbiz_base + "buynow'","storefront", "installers");
			this.addMenu("myvudu","myvuduhome:document.location.href='" + this.ofbiz_base + "buynow/control/myvuduhome'","account:document.location.href='" + this.ofbiz_base + "buynow/control/viewprofile'","community","boxsetup:document.location.href='" + this.ofbiz_base + "buynow/control/boxsetup'","activate:document.location.href='"+this.activationCode+"'","login:VUDU_login()");
		} else {
		   //this.addMenu("product","overview","testme:document.location.href='" + this.local_base + "product_bandwidth.html'","movies","specs","faq","reviews");
		   //this.addMenu("product","overview","testme:document.location.href='http://speedtest.vudu.com'","reviews",);
		   this.addMenu("product","overview","vudu","vudu_xl_home_theater:document.location.href='"+this.hometheater+"'","wireless","reviews","testimonials","faq");
		   //this.addMenu("buy");
		   this.addMenu("movies:document.location.href='" + this.local_base + "movies.html'");
		   this.addMenu("buy","orderfromvudu" , "storefront", "installers");
		   this.addMenu("myvudu","myvuduhome","account","community","boxsetup","activate","login:VUDU_login()");

		}
		//   this.addMenu("support","documentation","supportfaq:document.location.href='http://supports.vudu.com'","forums:document.location.href='http://forum.vudu.com/'","glossary:document.location.href='http://supports.vudu.com/glossary.php'","contact:document.location.href='http://supports.vudu.com/contact.php'");
		if (this.support) this.addMenu("support:document.location.href='" + this.support + "'");
		//this.addMenu("aboutus","background","press","jobs","resellerhome","contactus");
		//this.addMenu("login:VUDU_login()");
		this.addFooter("About Us",this.local_base + "aboutus_background.html","Contact Us",this.local_base + "aboutus_contactus.html","Press",this.local_base + "aboutus_press.html","Terms of Service",this.local_base + "termsofservice.html","Privacy Policy",this.local_base + "privacypolicy.html" );
	}

}

VUDUManager.prototype.logoutuser = function()	{
	
	CookieMonster.deleteCookie("myvudu.userName");
	CookieMonster.deleteCookie("myvudu.sessionKey");
	CookieMonster.deleteCookie("myvudu.userId");
	CookieMonster.deleteCookie("roles");
	CookieMonster.deleteCookie("VUDU_SUPPORT_URL");
	CookieMonster.deleteCookie("VUDU_SUPERMAN");
	CookieMonster.deleteCookie("VUDU_SUPERBOY");
	CookieMonster.deleteCookie("VUDU_SITE_URL");
	CookieMonster.deleteCookie("JSESSIONID");
	CookieMonster.deleteCookie("VUDU_LOGIN");
	CookieMonster.deleteCookie("VUDU_CART");
	CookieMonster.deleteCookie("buynow.autoUserLoginId");
}

VUDUManager.prototype.drawStart = function (pageid, subpageid)
{
    this.initMenu();
    if ((pageid == "buy") && (!subpageid || (subpageid == ""))) subpageid = "orderfromvudu";

    this.current_page = pageid;
    this.current_sub = pageid;
    this.active_sub = subpageid;

    //var opage = pageid;

    //FIRST TABLE IS OUTSIDE PAGE TABLE
	var ss = "<table id=v1 width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr><td width=" + this.outer_inset + " style='background-image:url(" + VM.base+ "vudu_back.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + "px;'><img src='" + VM.base+ "spacer.png' width=" + this.outer_inset + " height=9 alt='-'></td>";
	    	
	if (this.white) {
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_leftw1.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><div style='width:6;'></div></td>";
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_leftw2.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";background-color:ffffff;'><div style='width:6;'></div></td>";
	    ss += "<td valign=top width=" + (this.inner_width - 64) + " align=left style='background-image:url(" + VM.base+ "vudu_centerw.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + ";background-color:ffffff;'>\n";
    } else {
		ss += "<td width=12 style='width:12;background-image:url(" + VM.base+ "vudu_left.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><div style='width:12;'></div></td>";
	    ss += "<td valign=top width=" + (this.inner_width - 64) + " align=left style='width:" + (this.inner_width - 64) + ";background-image:url(" + VM.base+ "vudu_center.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + ";'>\n";
    }
    //SECOND TABLE IS JUST INSIDE THE VUDU BORDER

	ss += "<table id=v2 iwidth='100%'  cellpadding=0 cellspacing=0 border=0 style='width:" + (this.inner_width + (this.inner_inset*2)) + ";'><tr><td colspan=3 height=" + (87 + (this.outer_inset - 40)) + " ></td></tr><tr><td valign=top style='width:" + this.inner_inset + ";opacity:.5;'><div style='width:" + this.inner_inset + ";'></div></td><td valign=top>\n";

    if (this.before_nav) ss += this.before_nav;
    var navh = (this.hasSub() ? 55 : 24);
    //FINAL TABLE IS FOR THE INNER CONTENTS
	ss += "<table id=v3 iwidth='100%' cellpadding=0 cellspacing=0 cellborder=0 border=0 style='width:" + this.inner_width + ";'><tr><td height=82>";
	
	ss += "<table cellpadding=0 cellspacing=0 cellborder=0 border=0 width=" + this.inner_width + ">";
	
	ss += "<tr><td width=140 align=right rowspan=2><a href=\"" + this.home + "\"><img alt='Vudu - Movies on Demand' src='" + VM.base+ "vudu_logo_top.png' width=140 height=82 style='float:left;cursor:pointer;" + (this.turbo_inset ? "padding-left:" + this.turbo_inset + ";" : "") + "'></a></td><td valign=\"top\" width=660 height=54>";
	
	// Username is set by MyLogin.html
	var username = CookieMonster.getCookie("myvudu.userName");
	var showCart = false;
	var cartValue = CookieMonster.getCookie("VUDU_CART");
    if (cartValue) {
        cartValue = parseInt(cartValue);
		if(cartValue > 0 )    {
			var showCart = true;
		}
    }
	if(this.nocart == 1)  {
	   showCart = false;
	}
	ss += "<table cellpadding=0 cellspacing=0 border=0><tr><td width='510' height='24'></td><td width='164' align='right'><a href='";
	ss += ( (username)? VM.logout_url : VM.login_url );
	ss += "' class='vudu-main-menu'><div style='text-align:right; padding-right: 4px; padding-bottom: 6px;'><span>" ; 
	ss += ( (username)? "Logout": "Login" );
	if (!showCart) {
		ss += "</span></div></a></td><td width='3'><img src='" + VM.base + "vudu_divider.png' /></td><td><a href='"; 
		ss += this.activationCode;
		ss += "' class='vudu-main-menu'><div style='padding-left: 4px; padding-bottom: 6px;'><span>Activate</span></div></a></td></tr>";
	}
	else {
		ss +=  "</span></div></a></td><td width='3'><img src='" + VM.base + "vudu_divider.png' /></td><td>"; 
		ss +=  (VM.show_cart ? "<div id='just_cart' style='position:relative;float:right;top:2;'>" + VM.drawCart(VM.cart_items) + "</div>" : "");
		ss +=  "</td></tr>";
	}
	if(username)	{
		ss += "<tr><td height='' colspan='4' align='right' >"+username+"</td></tr>";
	}
	ss += "</table>";
    ss += "</td></tr>";
    ss += "<tr><td valign=\"bottom\" width=660><div id=\"vudu-menu\" style=\"position: relative;float: left; height:28px; display:block; width: 660px; z-index:10;\"></div></td></tr>";
	ss += "<tr><td colspan=2><img src='" + VM.base + "vudu_rule.png' width='800'></td></tr></table>";
	ss += "</td></tr>";
	ss += "<tr><td valign=top>";
		
    
    if (this.white) {
	    ss += "<div id='topcorners' style='width:100%;height:5px;background-color:ffffff;'><img alt='-----' src='" + VM.base+ "vudu_left_corner.png' width=5 height=5 hspace=0 vspace=0 style='float:left;'><img alt='-----' src='" + VM.base+ "vudu_right_corner.png' width=5 height=5 hspace=0 vspace=0 style='float:right;'></div>" ;
	}
	ss += "<div id='container' class=vudu_normal style='width:100%;"+  (this.white ? "background-color:ffffff;" : "") + "'>" ;

    var s2 =  "<div id='container2' iclass=vudu_normal style='" + (this.inner_top ? "padding-top:" + this.inner_top + ";" : "") + (((VM.margin_left == 0) && (VM.margin_right == 0)) ? "width:100%;" : "") + ((this.margin_left != 0) ? "padding-left:" + this.margin_left + ";" : "") + ((this.margin_right != 0) ? "padding-right:" + this.margin_right + ";" : "") +  (this.white ? "background-color:ffffff;" : "") + "'>\n" ;

        if (this.message) {
            s2 += "<div id=vudu_message class='vudu_message' style='margin-left:88;'><div >" + this.message + "</div></div><!--div style='clear:left;'></div-->	";
            this.message = 0;

    	}
        if (this.error) {
            s2 += "<div id=vudu_error class='vudu_error' style='margin-left:88;'><div >" + this.error + "<div style='clear:left;'></div></div></div><!--div style='clear:left;'></div-->	";
            this.error = 0;

    	}

   // alert(s2);
    ss += s2;
    var t = document.location.href;
    if (0 || ((this.current_page == "buy") && (this.active_sub != "wheretobuy") && ((this.active_sub != "storefront") && (this.active_sub != "online") && (this.active_sub != "installers")) && (t.indexOf("showcart") == -1))) {

            s2 = "<div style='position:relative;left:0;top:-10;'><table width=600 cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td align=center></td></tr></table></div>";


          ss += s2;
	}
	return ss;
}
VUDUManager.prototype.drawStart1 = function (pageid, subpageid)
{
    this.initMenu();
    this.current_page = pageid;
    this.current_sub = pageid;
	var ss = "<table id=v1 width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr><td width=" + this.outer_inset + " style='background-image:url(" + VM.base+ "vudu_back.png);background-repeat:repeat-x;'><img src='" + VM.base+ "spacer.png' width=" + this.outer_inset + " height=9 alt='-'></td>";

	if (this.white) {
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_leftw1.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><div style='width:6;'></div></td>";
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_leftw2.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";background-color:ffffff;'><div style='width:6;'></div></td>";
	    ss += "<td valign=top width=" + (this.inner_width - 64) + " align=left style='background-image:url(" + VM.base+ "vudu_centerw.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + ";background-color:ffffff;'>\n";
    } else {
		ss += "<td width=12 style='width:12;background-image:url(" + VM.base+ "vudu_left.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><div style='width:12;'></div></td>";
	    ss += "<td valign=top width=" + (this.inner_width - 64) + " align=left style='background-image:url(" + VM.base+ "vudu_center.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + ";'>\n";
    }

	ss += "<table id=v2 width='100%'  cellpadding=0 cellspacing=0 border=0><tr><td colspan=3 height=" + (87 + (this.outer_inset - 40)) + " ></td></tr><tr><td valign=top style='width:" + this.inner_inset + ";opacity:.5;'><div style='width:" + this.inner_inset + ";'></div></td><td valign=top>\n";

    var navh = (this.hasSub() ? 55 : 24);
	ss += "<table id=v3 width='100%' cellpadding=0 cellspacing=0 border=0><tr><td   align=left valign=top height=77><img alt='Vudu Logo' src='" + VM.base + "vudu_logo5" + (this.logo ? "_" + this.logo : "") + ((pageid == "3") ? "s" : "") + ".png' width=333 height=65 hspace=0 vspace=0 style='cursor:pointer;' onClick=\"document.location.href='" + this.home + "'\" style='cursor:pointer;' ></td><td align=right valign=top><img alt='Vudu Remote' src='" + VM.base+ "vudu_remote_hint.png' width=275 height=77></td></tr><tr><td valign=bottom colspan=2 height=10><img alt='-----' src='" + VM.base+ "vudu_rule.png' width=" + this.inner_width + " height=5></td></tr><tr><td valign=top colspan=2 style='height:" + navh + ";'>\n";

    ss += VM.nav.drawNav(pageid, subpageid);
	ss += "</td></tr><tr><td colspan=2 valign=top><div style='width:20;height:10;'></div>";

    if (this.white) {
	    ss += "<div id='topcorners' style='width:100%;height:5px;background-color:ffffff;'><img alt='-----' src='" + VM.base+ "vudu_left_corner.png' width=5 height=5 hspace=0 vspace=0 style='float:left;'><img alt='-----' src='" + VM.base+ "vudu_right_corner.png' width=5 height=5 hspace=0 vspace=0 style='float:right;'></div>" ;
	}
	ss += "<div id='container' class=vudu_normal style='width:100%;"+  (this.white ? "background-color:ffffff;" : "") + "'>" ;

    var s2 =  "<div id='container2' iclass=vudu_normal style='" + (((VM.margin_left == 0) && (VM.margin_right == 0)) ? "width:100%;" : "") + ((this.margin_left != 0) ? "padding-left:" + this.margin_left + ";" : "") + ((this.margin_right != 0) ? "padding-right:" + this.margin_right + ";" : "") +  (this.white ? "background-color:ffffff;" : "") + "'>\n" ;
   // alert(s2);
    ss += s2;
	return ss;
}

VUDUManager.prototype.init = function ()
{
	this.syncLogin();
	this.syncCart();
}

function VUDU_guarantee()
{
	document.getElementById("guarantee").style.display = VM.guarantee ? "none" : "block";
	document.getElementById("guarantee_link").innerHTML = (VM.guarantee ? "+" : "-") + " 30-DAY SATISFACTION GUARANTEE";
	VM.guarantee = VM.guarantee ? 0 : 1;
}

function VUDU_nearestID(obj)
{
	var objn = obj;
	while (objn && (!objn.id) || (objn.id == "")) objn = (objn.parentNode ? objn.parentNode : 0);
	return (objn ? objn : obj);
}

VUDUManager.prototype.drawEnd = function (pageid, subpageid)
{
   ss = "";
   var s2 = "";

    var t = document.location.href;
    var takeout;
    var found = 0;
    var parent = 0;

    s2 = "<div class=clear><!-- -->" + VM.drawBoxStart(-1, 0, 0, 0,  "<span style='position:relative;left:-8;top:10;'>A Quick Survey</span>");

s2 += "<table iwidth=600 cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td align=left iclass=buy_comments_inner istyle='font-size:10;color:666666;' colspan=2><!div style=\"iposition: absolute; left: 0pt;\" class=\"vudu_balloon_body\" id=\"pre_email\"><br>We would appreciate knowing how you found out about Vudu.  Could you spare a few seconds to fill out the worlds shortest marketing questionnaire?<form target=\"request\" name=\"wherebuy\" id=\"wherebuy\" method=\"post\" action=\"/perl/wherebuy.cgi\"></td></tr><tr><td valign=top>How did you learn about VUDU?<p><span style='position:relative;left:20;'><input type=radio value='in-store' name='learn'> In-store display</span><br><span style='position:relative;left:20;'><input type=radio value='radio' name='learn'> Radio</span><br><span style='position:relative;left:20;'><input type=radio value='tv' name='learn'> TV</span><br><span style='position:relative;left:20;'><input type=radio value='magazine' name='learn'> Magazine Review</span><br><span style='position:relative;left:20;'><input type=radio value='online' name='learn'> Online Article <font size=-2>(Gizmodo, Engadget, CNET)</font></span><br><span style='position:relative;left:20;'><input type=radio value='search' name='learn'> Search engine</span><br><span style='position:relative;left:20;'><input type=radio value='newspaper' name='learn'> Newspaper</span><br><span style='position:relative;left:20;'><input type=radio value='store-employee' name='learn'> Store employee</span><br><span style='position:relative;left:20;'><input type=radio value='word-of-mouth' name='learn'> Word of mouth</span><br><span style='position:relative;left:20;'><input type=radio value='other' name='learn'> Other</span><br></td><td valign=top>Where did you purchase your VUDU box?<p><span style='position:relative;left:20;'><input type=radio value='vudu.com' name='purchase'>VUDU.com   </span><br><span style='position:relative;left:20;'><input type=radio value='kiosk' name='purchase'>VUDU kiosk   </span><br><span style='position:relative;left:20;'><input type=radio value='amazon' name='purchase'>Amazon   </span><br><span style='position:relative;left:20;'><input type=radio value='bestbuy' name='purchase'>Best Buy</span><br><span style='position:relative;left:20;'><input type=radio value='tweeter' name='purchase'>Tweeter   </span><br><span style='position:relative;left:20;'><input type=radio value='magnolia' name='purchase'>Magnolia AV   </span><br><span style='position:relative;left:20;'><input type=radio value='installer' name='purchase'>Custom Installer</span><br><span style='position:relative;left:20;'><input type=radio value='hawaiian' name='purchase'>Hawaiian Telcom</span><br><span style='position:relative;left:20;'><input type=radio value='gift' name='purchase'>Gift</span><br><span style='position:relative;left:20;'><input type=radio value='other' name='purchase'>Other</span><br></td></tr><tr><td colspan=2><!input type=\"text\" name=\"email\" class=\"vudu_form_email\"/><br><input type=\"submit\" class=\"vudu_form_button\" value=\"Submit\" /></form><p /><!/div></td></tr></table><i" + "fr" +"ame id='request' name='request' style='visibility:hidden;position:absolute;top:0;left:0;'></" + "ifr" + "ame>";

//s2 += "<table iwidth=600 cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td align=left class=buy_comments_inner style='font-size:10;color:666666;' colspan=2><div style=\"iposition: absolute; left: 0pt;\" class=\"vudu_balloon_body\" id=\"pre_email\"><br>We would appreciate knowing how you found out about Vudu.  Could you spare a few seconds to fill out the worlds shortest marketing questionnaire?<form target=\"request\" name=\"wherebuy\" id=\"wherebuy\" method=\"post\" action=\"/perl/wherebuy.cgi\"></td></tr><tr><td valign=top>How did you learn about VUDU?<ul><li><input type=radio value='in-store' name='learn'> In-store display</li><li><input type=radio value='radio' name='learn'> Radio</li><li><input type=radio value='tv' name='learn'> TV</li><li><input type=radio value='magazine' name='learn'> Magazine Review</li><li><input type=radio value='online' name='learn'> Online Article (Gizmodo, Engadget, CNET)</li><li><input type=radio value='search' name='learn'> Search engine</li><li><input type=radio value='newspaper' name='learn'> Newspaper</li><li><input type=radio value='store-employee' name='learn'> Store employee</li><li><input type=radio value='word-of-mouth' name='learn'> Word of mouth</li><li><input type=radio value='other' name='learn'> Other</li></ul></td><td valign=top>Where did you purchase your VUDU box?<ul><li><input type=radio value='vudu.com' name='purchase'>VUDU.com   </li><li><input type=radio value='kiosk' name='purchase'>VUDU kiosk   </li><li><input type=radio value='amazon' name='purchase'>Amazon   </li><li><input type=radio value='bestbuy' name='purchase'>Best Buy</li><li><input type=radio value='tweeter' name='purchase'>Tweeter   </li><li><input type=radio value='magnolia' name='purchase'>Magnolia AV   </li><li><input type=radio value='installer' name='purchase'>Custom Installer</li><li><input type=radio value='hawaiian' name='purchase'>Hawaiian Telcom</li><li><input type=radio value='gift' name='purchase'>Gift</li><li><input type=radio value='other' name='purchase'>Other</li></ul></td></tr><tr><td colspan=2><!input type=\"text\" name=\"email\" class=\"vudu_form_email\"/><input type=\"submit\" class=\"vudu_form_button\" value=\"Submit\" /></form><p /></div></td></tr></table><i" + "fr" +"ame id='request' name='request' style='visibility:hidden;position:absolute;top:0;left:0;'></" + "ifr" + "ame>";

s2 += VM.drawBoxEnd(-1);
       // ss += s2;

   if ((this.current_page == "buy") && ((this.active_sub != "storefront") && (this.active_sub != "online") && (this.active_sub != "installers")) && (t.indexOf("showcart") == -1)) {
        //alert(this.current_sub);

		if ((takeout = document.getElementsByTagName("img"))) {
			for (var a = 0; a < takeout.length; a++) {
				if ((takeout[a].src.indexOf("/vudu_checkout_button_150d.gif") != -1) || (takeout[a].src.indexOf("/vudu_checkout_button_150.gif") != -1)) {

					parent = VUDU_nearestID(takeout[a]);
					if (parent && (parent.id == "vudu_checkout1")) {
						if (found) {
							parent.style.display = "none";
						} else {
							found++;
						}
					}
				}
			}
		}

        //TO SHIP IN ONE BUSINESS DAY
		   s2 = "<BR><BR><BR><BR><div class='buy_comments_frame'><table width=600 cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td align=left class=buy_comments_inner style='font-size:10;color:666666;'>AVAILABLE IN<br><nobr>THE U.S. ONLY &nbsp;</nober></td><td align=right class=buy_comments_inner style='font-size:10;color:666666;'>&nbsp;IN STOCK ITEMS USUALLY SHIP IN ONE TO TWO BUSINESS DAYS, EXCLUDING HOLIDAYS<br><a href='javascript:VUDU_guarantee();' style='cursor:pointer;' id='guarantee_link'>+ 30-DAY SATISFACTION GUARANTEE</a></td></tr><tr><td colspan=2  ialign=left class=buy_comments_inner style='font-size:10;color:666666;text-align:justify;'><div id='guarantee' style='display:none;'><br>VUDU offers a 30-day satisfaction guarantee which means, if for any reason you wish to return a box purchased directly through VUDUs website within the first thirty days from the day it was shipped, we will refund the price of the box. Purchases made from other retailers are subject to their respective return policies. Please note that the original shipping costs and your return shipping costs are non-refundable. We can only refund the credit card used in the original purchase. The refund will occur within 7 to 14 business days of us receiving the box in (as new) condition and with original packaging. For orders originating in the state of California, we will also refund any state sales tax incurred.</div></td></tr></table></div>";

		 //  s2 = "<div class='buy_comments_frame'><table width=600 cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td align=left class=buy_comments_inner style='font-size:10;color:666666;'>AVAILABLE IN<br><nobr>THE U.S. ONLY &nbsp;</nober></td><td align=right class=buy_comments_inner style='font-size:10;color:666666;'>&nbsp;ORDERS PLACED TODAY ARE EXPECTED TO SHIP IN EARLY OCTOBER 2007<br><span onclick='alert(\"VUDU offers a 30-day satisfaction guarantee which means, if for any reason you wish to return a box purchased directly through VUDUs website within the first thirty days from the day it was shipped, we will refund the price of the box. Purchases made from other retailers are subject to their respective return policies. Please note that the original shipping costs and your return shipping costs are non-refundable. We can only refund the credit card used in the original purchase. The refund will occur within 7 to 14 business days of us receiving the box in (as new) condition and with original packaging. For orders originating in the state of California, we will also refund any state sales tax incurred.\")' style='cursor:pointer;'>30-DAY SATISFACTION GUARANTEE</span></td></tr></table></div>	";


        ss += s2;
	}
    if (t.indexOf("contact.php") != -1) {
		if (f = document.getElementById("question")) f.style.backgroundColor = "#FFFFFF";
	}
   ss += "</div>";
	ss += "<div class=clear><!-- --></div>";

	ss += "<table cellpadding=0 cellspacing=0 border=0 width='100%' ><tr><td valign=top height=15 colspan=2><img alt='-----' src='" + VM.base+ "vudu_rule" + (this.white ? "w" : "") + ".png' width=" + this.inner_width + " height=5></td></tr>";
    ss += "<tr><td align=right height=25>" + this.drawFooter() + "</td>";
	ss += "<td width=250><div style='position:relative;float:left;text-align:left;margin-left:15px;'><div style='position:relative;float:left;width:120px;' class='vudu-main-menu'><span style='color:#FF8F00;'>Follow VUDU on: </span></div><div style='position:relative;float:left;width:30px;'><a href='http://www.facebook.com/pages/VUDU/17264801751?ref=ts'><img src='"+VM.base+"facebook_logo_black.jpg' alt='F' title='VUDU on Facebook'/></a></div><div style='position:relative;float:left;width:30px;'><a href='http://twitter.com/vudufans'><img src='"+VM.base+"twitter_logo_black.jpg' alt='T' title='VUDU on twitter'/></a></div></div></td></tr>";
	ss += "<tr><td align=center valign=top height=20 colspan=2><div class=vudu_copyright2>&copy; 2008 VUDU, Inc. All rights reserved.</div></td></tr></table>";


	ss += "</div>";

    ss += "</td></tr></table></td><td valign=top style='width:" + this.inner_inset + ";'><img src='" + VM.base+ "spacer.png' width=" + this.inner_inset + " height=9 alt='-'></td></tr></table></td>";

    if (this.white) {
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_rightw1.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";background-color:ffffff;'><img src='" + VM.base+ "spacer.png' width=6 height=9 alt='-'></td>";
		ss += "<td width=6 style='width:6;background-image:url(" + VM.base+ "vudu_rightw2.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><img src='" + VM.base+ "spacer.png' width=6 height=9 alt='-'></td>";
	} else {
		ss += "<td width=12 style='width:12;background-image:url(" + VM.base+ "vudu_right.png);background-repeat:no-repeat;background-position:0px " + (this.outer_inset - 40) + ";'><img src='" + VM.base+ "spacer.png' width=12 height=9 alt='-'></td>";
	}

	ss += "<td style='background-image:url(" + VM.base+ "vudu_back.png);background-repeat:repeat-x;background-position:0px " + (this.outer_inset - 40) + ";'><img src='" + VM.base+ "spacer.png' width=" + this.outer_inset + " height=9 alt='-'></td></tr>\n";//v3


    ss += "</table><div id=extra_stuff style='display:none;position:absolute;top:0;left:0;'></div><div id='status_reel' style='position:absolute;top:-50;left:-50;width:23;height:23;display:none;opacity:.8;'></div>\n\n";

	return ss;
}


VUDUManager.prototype.drawBoxStart = function (step, step_state, step_action, outer_title, inner_title)
{
	var ss = "";

    if (outer_title) {
	   ss += "<div class=\"vudu_headline\" style='position:relative;left:88;'>" + outer_title + "&nbsp;<br /></div>";
    }
	if (step && (typeof step == 'function')) {
		ss += step();
	} else if (step && isNaN(step)) {
		ss += eval(step);
		ss += "<div style='float:left;'>";
		s = 1;
	} else if (step > 0) {
		ss += "<div class=\"vd_bio_icon\" style='width:88;float:left;vertical-align:top;'><img src='" + VM.base + "step_"  + (this.step_icon ? this.step_icon : step) + ((step_state == 1) ? "b" : ((step_state == 2) ? "c" : "a")) + ".png" + "' width=59 height=67 style='" + ((step_action && (step_state != 1)) ? "cursor:pointer;" : "") + "position:relative;left:20;' border=0 " + ((step_action && (step_state != 1)) ? "onclick='" + step_action + "'" : "") + "></div><div style='float:left;'>";
		s = 1;
	} else if (step == -1){
		ss += "<div class=\"vd_bio_icon\" style='width:88;float:left;vertical-align:top;'><img src='" + VM.base + "spacer.png' width=59 height=67 style='position:relative;left:20;' border=0 ></div><div style='float:left;'>";
		s = 1;
	}
	ss +=  "<div class=\"vd_bio_outer\">" +
	"<div class=\"vd_bio_n\"></div>" +
	"<div class=\"vd_bio\">" +
	"<div class=\"vd_productin\">" +
	"<div class=\"vudu_bio_body2\">";

	if (inner_title)
	   ss += "<div class=\"vudu_headline_sub\" style='position:relative;'>" + inner_title + "<br /></div>";

       //ss += "<div id='box_inset' class=vudu_normal style='margin-left:0px;'>" ;

               if (this.message) {
                   ss += "<div id='vudu_message' class='vudu_message'><div>" + this.message + "</div></div><!--div style='clear:left;'></div-->	";
                   this.message = 0;

           	}
               if (this.error) {
                   ss += "<div id='vudu_error' class='vudu_error'><div>" + this.error + "<div style='clear:left;'></div></div></div><!--div style='clear:left;'></div-->	";
                   this.error = 0;

           	}

	   return ss;

}


VUDUManager.prototype.drawBoxStartN = function(wid, hei)
{
	var ss = "<table cellpadding=0 cellspacing=0 cellborder=0 border=0 style='width:" + wid + ";height:" + hei + ";' height=" + hei + "><tr><td style='height:14;'><div class=\"vd_bio_n0\"><div class=\"vd_bio_n1\"></div><div class=\"vd_bio_n2\" style='width:" + (wid-28) + ";'></div><div class=\"vd_bio_n3\"></div></div></td></tr><tr><td align=left valign=top style='background-color:121212;'>";
	return ss;

}

VUDUManager.prototype.drawBoxEndN = function(wid)
{
	var ss = "</td></tr><tr><td style='height:14;'><div class=\"vd_bio_s0\"><div class=\"vd_bio_s1\"></div><div class=\"vd_bio_s2\" style='width:" + (wid-28) + ";'></div><div class=\"vd_bio_s3\"></div></div></td></tr></table>";
	return ss;
}


VUDUManager.prototype.drawBoxEnd = function (step)
{
	var ss = "";
	//ss += "</div>";
	ss += "</div>" +
	"<div class=\"clear\"><!-- --></div></div></div>" +
	"<div class=\"vd_bio_s\"></div></div>";
	if (!((step < -1) || (step == 0))) ss += "</div><div style='clear:left;'></div>";
	return ss;
}


VUDUManager.prototype.drawBio = function (id, name, title, brief, bio, education)
{
	var ss = this.drawBoxStart(-1,0,0,0,0);

	ss += "<img alt=\"" + id + "\" class=\"vudu_bio_pix\" src=\"" + this.base + "actor_" + id + ".jpg\" /><div class=\"vudu_bio_title\">" + name + " &mdash; " + title + "<br /></div>" + brief + " <span>&nbsp;</span><span class=\"vudu_bio_more\" id=\"bio" + this.management_index + "a\" style=\"display: inline; cursor: pointer;\"><a href=\"javascript:revealbio(" + this.management_index + ",1)\">(more...)</a></span><span id=\"bio" + this.management_index + "b\" style=\"display: none;\">" + bio + "<br><br>" + education + "</span><span id=\"bio" + this.management_index + "c\" class=\"vudu_bio_more\" style=\"display: none; cursor: pointer;\">&nbsp;<a href=\"javascript:revealbio(" + this.management_index + ",0)\">(less...)</a></span>";

    this.management_index++;
	ss += this.drawBoxEnd(-1);
	return ss;
}

VUDUManager.prototype.drawSpec2 = function ()
{
	var ss = (arguments[0] ? "<div class=vudu_fade_title>" + arguments[0] + "</div>" : "") + "<table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);'><div class=vudu_fade_edge style='height:1;'></div></td></tr><td><td><div class=vudu_fade_contents>";

	for (var a = 1; a < arguments.length; a++) {
		ss += "<div class=vudu_fade_item>" +arguments[a] + "</div>";
	}
	ss += "</div></td></tr><tr><td style='height:1;'><div class=vudu_fade_edge></div></td></tr></table>";
	return ss;
}


VUDUManager.prototype.drawLink = function (url, icon, title, link_title, plur)
{

return "<table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td><!div style=\"float: left;\"><a " + ((icon == "logos") ? "id=vudu_plogo_link " : "") + (((icon.substring("pdf") != -1) || (icon == "logos")) ? "target=\"_blank\"" : "") + " href=\"" + url + "\"><img  src=\"" + this.base + "link_" + icon + ".png\" alt=\"" + icon + "\" width=27 height=36/></a><!/div></td><td align=right valign=top><div class=\"vudu_press_item" + (plur ? "s" : "") + "\" !style=\"float: left;\"><nobr>" + title + "</nobr></div></td><td align=left valign=top><div class=\"vudu_press_item" + (plur ? "s" : "") + "\" !style=\"float: left;\"><a " + ((icon == "logos") ? "id=vudu_plogo_link2 " : "") + (((icon.substring("pdf") != -1) || (icon == "logos")) ? "target=\"_blank\"" : "") + " href=\"" + url + "\">" + link_title  + "</a></div></td></tr></table>";

}
VUDUManager.prototype.drawGroup = function ()
{
	var ss = (arguments[1] ? "<div class=vudu_fade_title>" + arguments[1] + "</div>" : "") + "<table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr><tr><td><div class=vudu_fade_contents><img src='" + this.base + "spacer.png' width=" + arguments[0] + " height=1><br>";

	for (var a = 2; a < arguments.length; a++) {
		ss += "<div class=vudu_fade_item style='font-size:12;'>" +arguments[a] + "</div>";
	}
	ss += "</div></td></tr><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr></table>";
	return ss;
}
VUDUManager.prototype.drawSpec = function ()
{
	var ss = (arguments[1] ? "<div class=vudu_fade_title>" + arguments[1] + "</div>" : "") + "<table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr><tr><td><div class=vudu_fade_contents><img src='" + this.base + "spacer.png' width=" + arguments[0] + " height=1><br>";

	for (var a = 2; a < arguments.length; a++) {
		ss += "<div class=vudu_fade_item>" +arguments[a] + "</div>";
	}
	ss += "</div></td></tr><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr></table>";
	return ss;
}

VUDUManager.prototype.draw2Spec = function ()
{
	var ss = (arguments[1] ? "<div class=vudu_fade_title>" + arguments[1] + "</div>" : "") + "<table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr><tr><td><div class=vudu_fade_contents_installer>";

	for (var a = 2; a < arguments.length; a++) {
		ss += "<div class=vudu_fade_item>" +arguments[a] + "</div>";
	}
	ss += "</div></td></tr><tr><td style='height:1;background-image:url(" + this.base + "fade_edge.png);background-repeat:no-repeat;'></td></tr></table>";
	return ss;
}

VUDUManager.prototype.drawFAQ = function (index, question, answer)
{
	var ss = "";//this.drawBoxStart(-1,0,0,0,0);

	ss += "<div class=\"vudu_bio_more\" id=\"bio" + this.management_index + "a\" style=\"display: inline; cursor: pointer;\"><a href=\"javascript:revealbio(" + this.management_index + ",1)\">" + index + ". " + question + "&nbsp;</a></div><div class=\"vudu_bio_more\" id=\"bio" + this.management_index + "b\" style=\"display: none;\"><a href=\"javascript:revealbio(" + this.management_index + ",0)\" style='color:ff8f00;'>" + index + ". " + question + "&nbsp;<span class='vudu_close_box'>&nbsp;-&nbsp;</span></a><p class=vudu_faq_answer style='margin-top:10px;'> " + answer + "</p></div><p>";

    this.management_index++;
	//ss += this.drawBoxEnd(-1);
	return ss;
}
VUDUManager.prototype.drawFAQ2 = function (index, question, answer)
{
	var ss = "";//this.drawBoxStart(-1,0,0,0,0);

	ss += "<span class=\"vudu_bio_more\" id=\"bio" + this.management_index + "a\" style=\"display: inline; cursor: pointer;\"><a href=\"javascript:revealbio(" + this.management_index + ",1)\">" + index + ". " + question + "</a></span><span id=\"bio" + this.management_index + "b\" style=\"display: none;\"><font style='color:ff8f00;'>" + index + ". " + question + "</font><p class=vudu_faq_answer><!--b>ANSWER:</b--> " + answer + "</p></span><span id=\"bio" + this.management_index + "c\" class=\"vudu_bio_more\" style=\"display: none; cursor: pointer;\">&nbsp;<a href=\"javascript:revealbio(" + this.management_index + ",0)\">(less...)</a></span><p>";

    this.management_index++;
	//ss += this.drawBoxEnd(-1);
	return ss;
}

VUDUManager.prototype.niceDate = function (val)
{
    var ss = "";
    for (var a = 0; a < val.length; a++) {
		if (val.charAt(a) == " ") ss += "_";
		else if (val.charAt(a) == ",");
		else {
			ss += val.charAt(a);
		}
	}
	return ss;
}

VUDUManager.prototype.drawReview = function (id, url, date, summary, quote, pdf)
{
	var ss = this.drawBoxStart(-1,0,0,0,0);
	ss += "<div istyle='float:left;'><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" ><tbody><tr>    <td valign=\"top\"><div ><a href=\"" + (pdf ? pdf : url) + "\" target=\"_blank\"  onClick=\"javascript:VM.googlePage('/outgoing/" + id + "_" + this.niceDate(date) + "');\"><img alt=\"" + id + "\" src=\"" + this.base + "logo_" + id + ".png\" class=\"vudu_review2_icon\" /></a><div class=\"vudu_review_date\" style='padding-top:6;'>" + date + "<p style='padding-top:10;'>" + summary + "</p></div></div><br /></td><td valign=\"top\"><div class=\"vudu_review_quote\">" + quote + "<p style='padding-top:10;'>";
	if (!pdf) {
		ss += "<a href=\"" + url + "\" target=\"_blank\" onClick=\"javascript:VM.googlePage('/outgoing/" + id + "_" + this.niceDate(date) + "');\">Click for more...</a>";
	} else {
		ss += "<a href=\"" + pdf + "\" target=\"_blank\" id=\"nytimes_link2\">Click for PDF,</a> or <a href=\""+ url + "\" target=\"_blank\" id=\"nytimes_link2\">read online...</a>"
	}
	ss += "</p></div></td></tr></tbody></table></div>";
	ss += this.drawBoxEnd(-1);
	return ss;
}

VUDUManager.prototype.updateButton = function (id, state)
{
	var current = 0;
	for (var a = 0; a < this.buttons.length; a++) {
		if (this.buttons[a].id == id) {
			current = this.buttons[a];
			break;
	    }
	}
	if (!current) {return;}
	if ((state != "d") && (state != "h")) state = "";
	current.state = state;
	if (f = document.getElementById("parent_" + current.id)) {
		var ss = "";
		if (current.state != "d") ss += "<a href='" + VM.scriptify(current.action) + "'>";
		ss += " <span " + (current.id ? "id='" + current.id + "'" : "") + " class=" + this.getButtonClassFor(current.title, current.icon) + current.state;
		if (current.state != "d") ss +=  " onMouseOut='VUDU_highlight(this, 0);' onMouseOver='VUDU_highlight(this, 1);' ";
		ss += " style='float:right;'><nobr>" + ((current.icon == "add") ? "&nbsp;&nbsp;" : "") + "&nbsp;&nbsp;" + current.title + "&nbsp;&nbsp;" + ((current.icon == "continue") ? "&nbsp;&nbsp;" : "") + "</nobr></span>" ;
		if (current.state != "d") ss += "</a>";
		f.innerHTML = ss;
	}
}

VUDUManager.prototype.drawButtons = function ()
{
	var ss = "";

	for (var a = 0; a < arguments.length; a+=5) {
		var icon = arguments[a+3];
		if ((icon != "add") && (icon != "continue")) icon = 0;

		var state = arguments[a+4];
		if ((state != "d") && (state != "h")) state = "";
		if (a) ss += "<span style='width:10;float:right;'><img src='" + this.base + "spacer.png" + "' width=10 height=10></span>";
		if (arguments[a+2]) ss += "<span id='parent_" + arguments[a+2] + "'>";
		if (state != "d") ss += "<a href='" + VM.scriptify(arguments[a+1]) + "'>";
		ss += " <span " + (arguments[a+2] ? "id='" + arguments[a+2] + "'" : "") + " class=" + this.getButtonClassFor(arguments[a], icon) + state;
		if (state != "d") ss +=  " onMouseOut='VUDU_highlight(this, 0);' onMouseOver='VUDU_highlight(this, 1);' ";
		ss += " style='float:right;'><nobr>" + ((icon == "add") ? "&nbsp;&nbsp;" : "") + "&nbsp;&nbsp;" + arguments[a] + "&nbsp;&nbsp;" + ((icon == "continue") ? "&nbsp;&nbsp;" : "") + "</nobr></span>" ;
		if (state != "d") ss += "</a>";
		if (arguments[a+2]) ss += "</span>";

        VM.addButton(arguments[a+2],arguments[a],arguments[a+1],icon,state);
    }
    return ss;
}

VUDUManager.prototype.drawButton = function ()
{
	var ss = "";
	for (var a = 0; a < arguments.length; a+=2) {
		if (a) ss += "<span style='width:10;float:right;'><img src='" + this.base + "spacer.png" + "' width=10 height=10></span>";
		ss += " <span id='button_" + this.button_count + "' class=" + this.getButtonClassFor(arguments[a], 0) + (((a < (arguments.length-1)) && (arguments[a+1])) ? "" : "d") + (((a < (arguments.length-1)) && (arguments[a+1])) ? " onMouseOut='VUDU_highlight_class(this, 0,\"" + this.getButtonClassFor(arguments[a], 0) + "\");' onMouseOver='VUDU_highlight_class(this, 1,\"" + this.getButtonClassFor(arguments[a], 0) + "\");' onclick='" + arguments[a+1] + "'" : "") + " style='float:right;'><nobr>&nbsp;&nbsp;" + arguments[a] + "&nbsp;&nbsp;</nobr></span>" ;

        this.button_count++;
    }

    return ss;
}

VUDUManager.prototype.drawLeftButton = function ()
{
	var ss = "";
	for (var a = 0; a < arguments.length; a+=2) {
		if (a) ss += "<span style='width:10;float:left;'><img src='" + this.base + "spacer.png" + "' width=10 height=10></span>";
		ss += " <span id='button_" + this.button_count + "' class=" + this.getButtonClassFor(arguments[a], 0) + (((a < (arguments.length-1)) && (arguments[a+1])) ? "" : "d") + (((a < (arguments.length-1)) && (arguments[a+1])) ? " onMouseOut='VUDU_highlight_class(this, 0,\"" + this.getButtonClassFor(arguments[a], 0) + "\");' onMouseOver='VUDU_highlight_class(this, 1,\"" + this.getButtonClassFor(arguments[a], 0) + "\");' onclick='" + arguments[a+1] + "'" : "") + " style='float:left;'><nobr>&nbsp;&nbsp;" + arguments[a] + "&nbsp;&nbsp;</nobr></span>" ;

        this.button_count++;
    }

    return ss;
}

VUDUManager.prototype.drawDash = function(top, right, bottom, left)
{
	return "<div style='height:4;margin:" + top + " " + right + " " + bottom + " " + left + ";position:relative;background-image:url(" + VM.base + "dash1.png);background-repeat:no-repeat;height:4;padding:0;'><!img src='" + VM.base + "spacer.png' width=10 height=4></div>";
}

VUDUManager.prototype.drawCart = function (cnt)
{
	var ss = "<div onclick='" + VM.cart + "' style='cursor:pointer;'><table cellpadding=0 cellspacing=0 cellborder=0 border=0><tr><td><img src='" + VM.base + "cart.png' width=24 height=24 style='border:0;'></td><td><nobr>";

	var tens = Math.floor(cnt/10.0);
	var ones = cnt - (tens*10);
    ss += "";
	if (cnt) {
		if (tens) {
			ss += "<img src='" + VM.base + "num_" + tens + ".png' height=24 style='border:0;'>";
		}
		ss += "<img src='" + VM.base + "num_" + ones + ".png' height=24 style='border:0;'>";
	}
	ss += "</nobr></td><td><img src='" + VM.base + (cnt ? ((cnt > 1) ? ("cart_items.png") : ("cart_item.png")) : ("cart_empty.png")) + "' height=24 style='border:0;'></td></tr></table></div>";
    return ss;
}

VUDUManager.prototype.updateCart = function (items)
{
    if (!this.show_cart) return;
    if (f = document.getElementById("just_cart")) {
		f.innerHTML = this.drawCart(items);
    }
    this.cart_items = items;
	CookieMonster.setCookie("VUDU_CART",items);
    //alert("setCookie:VUDU_CART " + items);
}

VUDUManager.prototype.syncCart = function (val)
{
	var ss = CookieMonster.getCookie("VUDU_CART");

    if (ss) {
		VM.cart_items = parseInt(ss);
		VM.updateCart(VM.cart_items);
	}
}

VUDUManager.prototype.updateLogin = function (val)
{
	VM.loggedin = val;
	if (f = document.getElementById("img_login")) {
		f.src = VM.base + "text_" + (VM.loggedin ? "logout" : "login") + "3" + ((VM.current_page == "login") ? "h" : "")  + ".png";

    }
    CookieMonster.setCookie("VUDU_LOGIN",VM.loggedin ? "1" : "0");
    //alert("setCookie:VUDU_LOGIN " + VM.loggedin);

}

VUDUManager.prototype.syncLogin = function (val)
{
	var ss = CookieMonster.getCookie("VUDU_LOGIN");
    if (ss) {
		VM.updateLogin(parseInt(ss) ? 1 : 0);
	}
}

VUDUManager.prototype.scriptify = function (val)
{
	if ((val.indexOf("(") != -1) || (val.indexOf("document.") != -1)) return ("javascript:" + val);
	else return val;
}

VUDUManager.prototype.googlePage = function (val)
{
 	if (pageTracker) pageTracker._trackPageview(val);
}

//INDIVIDUAL NAV BAR ITEMS
function VUDU_nav(id)
{
	this.id = id;
	this.location = 0;
	this.parent = 0;

	if (this.id.indexOf(":") != -1) {
		this.id = this.id.substring(0, this.id.indexOf(":"));
		this.location = id.substring(id.indexOf(":")+1, id.length);
	} else {
		if (id != "root") {
			for (var a = 0; a < VM.nav_hints.length; a+=2) {
				if (VM.nav_hints[a] == id) this.location = VM.nav_hints[a+1];
				//alert(VM.nav_hints[a+1]);
			}
		}
	}
	this.subnav = new Array();
}

VUDU_nav.prototype.addSub = function ()
{
	var c = 0;
	//alert(arguments.length);
	if (!arguments.length) return 0;
	for (var a = 0; a < arguments.length; a++) {
		c = this.subnav[this.subnav.length] = new VUDU_nav(arguments[a]);
		c.parent = this;
    }
	return c;
}

VUDU_nav.prototype.url = function ()
{
    var ss = "";
	if (this.location) return this.location;
    var p = this.parent;
    while (p && (p.id != "root")) {
        ss += p.id + "_";
        p = p.parent;
    }
	if (this.subnav.length) {
		if (this.subnav[0].location) return this.subnav[0].location;
		else return VM.local_base + ss + this.id + "_" + this.subnav[0].id + ".html";
	} else return VM.local_base + ss + this.id + ".html";
}

VUDU_nav.prototype.href = function ()
{
    var ss = "";
	if (this.location) return this.location;
    var p = this.parent;
    while (p && (p.id != "root")) {
        ss += p.id + "_";
        p = p.parent;
    }
	if (this.subnav.length) {
		if (this.subnav[0].location) return this.subnav[0].location;
		else return "document.location.href='" + VM.local_base + ss + this.id + "_" + this.subnav[0].id + ".html'";
	} else return "document.location.href='" + VM.local_base + ss + this.id + ".html'";
}




VUDU_nav.prototype.drawNav = function (pageid, subpageid)
{
	var ss = "";
	ss += this.drawTopNav(pageid, subpageid);
    ss += "<div class=clear><!-- --></div><div id='second_cont' style='position:relative;'>";
	var cnt = 0;
	for (var a = 0; a < this.subnav.length; a++) {
		ss += this.subnav[a].drawSubNav(a, pageid, subpageid);
		cnt++;
	}
	ss += "</div>";
	return ss;

}


VUDU_nav.prototype.drawTopNav = function (pageid, subpageid)
{
    var ss = "<div id='navbar_vudu' class='vudu_navbar'>\n<div style='width:" + (138.0+VM.turbo_inset) + ";float:left;'><br/></div>";
    var cnt = 0;

    for (var a = 0; a < this.subnav.length; a++) {
        if (a) {
		    ss += "\n<img  src='" + VM.base+ "vudu_divider.gif' hspace=0 vspace=0 style='width:11;height:24;float:left;'>";
	    }
        ss += "<div id='just_" + this.subnav[a].id + "' style='float:left;'>";
        if ((this.subnav[a].id != pageid) || VM.active) {
			ss += "<a href=\"" + VM.scriptify(this.subnav[a].url()) + "\"><img id='img_" + this.subnav[a].id + "' class=nav_center" + ((this.subnav[a].id == pageid) ? "h" : "");
		    ss += " onMouseOver='VUDU_showSub(this, \"nav_center" + ((this.subnav[a].id == pageid) ? "h" : "_hov") + "\",\"" + this.subnav[a].id + "\",0);' ";
		    ss += " onMouseOut='VUDU_showSub(this, \"nav_center" + ((this.subnav[a].id == pageid) ? "h" : "") + "\",0,1);' ";
            ss += " style='float:left;' ialt='" + this.subnav[a].id + "' src='" + VM.base+ "text_" + ((this.subnav[a].id == "login") ? (VM.logged_in ? "logout" : "login") : this.subnav[a].id) + "3" +((this.subnav[a].id == pageid) ? "h" : "") + ".png' hspace=0 vspace=0></a></div>";
        } else {
			ss += "<img id='img_" + this.subnav[a].id + "' class=nav_center" + ((this.subnav[a].id == pageid) ? "h" : "");
		    ss += " onMouseOver='VUDU_showSub(this,0, \"" + pageid + "\",0);' ";
            ss += " style='float:left;' ialt='" + this.subnav[a].id + "' src='" + VM.base+ "text_" + ((this.subnav[a].id == "login") ? (VM.logged_in ? "logout" : "login") : this.subnav[a].id) + "3" +((this.subnav[a].id == pageid) ? "h" : "") + ".png' hspace=0 vspace=0></div>";
	    }

        cnt++;
    }

    ss += "<div style='width:41;float:right;'><br/></div>" + (VM.show_cart ? "<div id='just_cart' style='position:relative;float:right;top:2;'>" + VM.drawCart(VM.cart_items) + "</div>" : "");
    ss += "</div>\n\n";
    return ss;
}


VUDU_nav.prototype.drawSubNav = function (index, pageid, subpageid)
{


    var xpos = (index*154 + 154/2.0) - Math.floor(((this.subnav.length-1)*104)/2);
    if (xpos < 0) xpos = 0;
    if ( (xpos + ((this.subnav.length)*154)) > (VM.nav.subnav.length*154)) xpos = (VM.nav.subnav.length*154) - ((this.subnav.length)*154);
    xpos += 45;
    if (index == 1) xpos = 63 + VM.turbo_inset;//alert(xpos);
    else if (index == 2) xpos = 143 + VM.turbo_inset;//alert(xpos);
    else if (index == 3) xpos = 215 + VM.turbo_inset;//alert(xpos);
    else if (index == 4) xpos = 153 + VM.turbo_inset;//alert(xpos);
   // else if (index == 4) xpos = 263 + VM.turbo_inset;//alert(xpos);
    else if (index == 5) xpos = 0 + VM.turbo_inset;//alert(xpos);
    else if (index == 6) xpos = 212 + VM.turbo_inset;//alert(xpos);
    xpos += 133;

    var ss = "";

	ss += "<div id='navbar_" + this.id + "' class='subnav_vudu' style='position:absolute;height:30;left:" + xpos + ";display:" + ((this.id == pageid) ? "block" : "none") + ";'>";
    var cnt = 0;
    for (var a = 0; a < this.subnav.length; a++) {
       var uid2 = this.subnav[a].id;
       if (a) {
		    ss += "<img src='" + VM.base+ "vudu_divider.gif' hspace=0 vspace=0 style='width:11;height:24;float:left;'>";
	   }

       if ((this.subnav[a].id != subpageid) || VM.active) {
           ss += "<a href=\"" + VM.scriptify(this.subnav[a].url()) + "\"><img id='img_" + uid2 + "' class=nav_center" + ((uid2 == subpageid) ? "h" : "");
		   ss += " onMouseOver='VUDU_showSub(this, \"nav_center" + ((uid2 == this.id) ? "h" : "_hov") + "\",\"zero\",0)' ";
		   ss += " onMouseOut='VUDU_showSub(this, \"nav_center" + ((this.id == uid2) ? "h" : "") + "\",0,1)' ";

		  // ss += " onClick=\"" +  this.subnav[a].href() + "\" ";
           ss += " ialt='" + this.subnav[a].id + "' src='" + VM.base+ "text_" + this.subnav[a].id + "3" + ((this.subnav[a].id == subpageid) ? "h" : "") + ".png' style='float:left;' hspace=0 vspace=0></a>";
       } else {
           ss += "<img id='img_" + uid2 + "' class=nav_center" + ((uid2 == subpageid) ? "h" : "");
           ss += " ialt='" + this.subnav[a].id + "' src='" + VM.base+ "text_" + this.subnav[a].id + "3" + ((this.subnav[a].id == subpageid) ? "h" : "") + ".png' style='float:left;' hspace=0 vspace=0>";

	   }

       cnt++;
    }
    ss += "</div>";
    //alert(ss);
    return ss;

}

VM = new VUDUManager();
CookieMonster.testCookie();


//VM.setOfbiz(0);





//sets the correct login or logout menu item for the new menu
if (CookieMonster.getCookie ("VUDU_SUPERBOY") != null) {var log = "Logout"}
else {var log = "Login"};
//sets the correct login or logout URL for the new menu
if (CookieMonster.getCookie ("VUDU_SUPERBOY") != null) {var logurl = "buynow/control/logout"}
else {var logurl = "buynow/control/checkLogin"};

(function()	{
		  
	// Singleton desing pattern
	VuduMenu = function( containerRef )   {
		
		this._containerRef = containerRef;
		
		this.imgSources = VM.base;;
		
		this._itemHeight = 30;
		
		this._itemWidth = 90;
		
		this._animationDuration = .25;
		
		this._mainMenuList = new Array();
		
		this._showingIndex = -1;
		
		this.jsonMenu = {
			
			title : "Default Menu", 
			root: "http://www.vudu.com",
			subMenu: [
			{ 
			  id: "getVUDU",
			  title : "Get VUDU",
			  subMenu : [
				{ title : "Overview", link : VM.local_base + "product_overview.html" },
				{ title : "LG", link : VM.local_base + "product_lg.html" },
				{ title : "Mitsubishi", link : VM.local_base + "product_mitsubishi.html" },
				{ title : "Samsung", link : VM.local_base + "product_samsung.html" },
				{ title : "SANYO", link : VM.local_base + "product_sanyo.html" },
				{ title : "Sharp", link : VM.local_base + "product_sharp.html" },
				{ title : "Toshiba", link : VM.local_base + "product_toshiba.html" },
				{ title : "VIZIO", link : VM.local_base + "product_vizio.html" },
				{ title : "VUDU Box", link : VM.local_base + "product_vudu.html" },
				{ title : "VUDU XL", link : VM.hometheater },
				{ title : "Wireless Kit", link : VM.local_base + "product_wireless.html" },
				{ title : "Reviews", link : VM.local_base + "product_reviews.html" } ]
			},
			{ 
			  id: "movies",
			  title : "Now Playing",
			  subMenu : [
				{ title : "All Movies", link : VM.local_base + "movies/?contentGenre=-1" },
				{ title : "New To Rent", link : VM.local_base + "movies/?contentGenre=-3" },
				{ title : "New To Own", link : VM.local_base + "movies/?contentGenre=-4" },
				{ title : "New Titles", link : VM.local_base + "movies/?contentGenre=-5" },
				{ title : "Coming Soon", link : VM.local_base + "movies/?contentGenre=-6" },
				{ title : "HDX", link : VM.local_base + "movies/?contentGenre=-7" },
				{ title : "HD", link : VM.local_base + "movies/?contentGenre=-8" } ]
			},
			{ 
              id: "blog", title : "Blog", link : "http://blog.vudu.com"
              
            },
			{ 
			  id: "community" , 
			  title : "Community", 
			  subMenu : [
			  	{ title : "Home", link : VM.local_base + "community.html" },
			  	{ title : "Forums", link : "http://forum.vudu.com" },
			  	{ title : "iPhone", link : VM.local_base + "product_iphone.html" },
			  	{ title : "VUDU Labs", link : VM.local_base + "vudulabs.html" },
				{ title : "VUDU Apps", link : VM.local_base + "vuduapps.html" }]
			},
			{ 
			  id: "support" , 
			  title : "Support",
			  subMenu : [
			  	{ title : "FAQ", link : "http://supports.vudu.com/" },
			  	{ title : "Documents", link : VM.local_base + "vudu_documentation.html?application=faq" },
			  	{ title : "Glossary", link : "http://supports.vudu.com/glossary.php" },
			  	{ title : "Contact", link : VM.local_base + "support_contact.html" } ]
			},
			{
			  id: "My VUDU", 
			  title : "My VUDU",
			  subMenu : [
			  	{ title : "Home", link : VM.local_base + "my_home.html"},
			  	{ title : "Account", link : VM.myAccount},
			  	{ title : "Manage Device", link : VM.myDevice},
			  	{ title : "Activate", link :VM.activationCode }]
			}]
		};
		
		this.render = function()	{
			
			if( this.jsonMenu && this.jsonMenu.subMenu && this.jsonMenu.root )             {
				
				var Dom = YAHOO.util.Dom;
				
				var container = Dom.get( this._containerRef );
				
				for(var  i = 0; i < this.jsonMenu.subMenu.length; i++ )    {
					// add to main container
					container.appendChild( this.makeMainMenuItem(this.jsonMenu.subMenu[i]) );
					
				    if( i < this.jsonMenu.subMenu.length - 1 )	{
				
						var menuSeperator = document.createElement('div');
						
						Dom.setStyle( menuSeperator, 'display', 'block');
						Dom.setStyle( menuSeperator, 'margin', '0px');
						Dom.setStyle( menuSeperator, 'padding', '0px');
			
						Dom.setStyle( menuSeperator , 'position', 'relative');
						Dom.setStyle( menuSeperator , 'float', 'left');
					
						
						Dom.setStyle( menuSeperator , 'width' ,'3');
						Dom.setStyle( menuSeperator , 'height' ,'30');
						
						menuSeperator.innerHTML = 
						'<img width="3" height="26" src="'+this.imgSources+'/vudu_divider.png" style="float:none;"/>';
						
						container.appendChild( menuSeperator );
					}
					else   {
						var menuEnd = document.createElement('div');
                        
                        Dom.setStyle( menuEnd, 'display', 'block');
                        Dom.setStyle( menuEnd, 'margin', '0px');
                        Dom.setStyle( menuEnd, 'padding', '0px');
                        Dom.setStyle( menuEnd, 'background-color', '#000000');
                        Dom.setStyle( menuEnd , 'position', 'relative');
                        Dom.setStyle( menuEnd , 'float', 'left');
                        Dom.setStyle( menuEnd , 'width' ,'12');
                        Dom.setStyle( menuEnd , 'height' ,'30');
                        
                        //menuEnd.innerHTML = 
                        //'<img width="3" height="26" src="'+this.imgSources+'/spacer.png" style="float:none;"/>';
                        
                        container.appendChild( menuEnd );
					}
				}
				
				var thisRef = this;
                		this.mouseChecker = setTimeout( function() { thisRef._checkMouse(); } , 1000 );

			}
		};
		
		this._checkMouse = function()	{
			
			if(!this._mouseOnMenu)	{
				this.showSubMenu();
			}
			var thisRef = this;
			this.mouseChecker = setTimeout( function() { thisRef._checkMouse(); } , 1000 );
		}
		
		this.reportMouse = function( status )	{
			this._mouseOnMenu = status;
		}
		
		this.makeMainMenuItem = function( jsonMenu )	{
			
			var Dom = YAHOO.util.Dom;
			var index = this._mainMenuList.length;
			
			var mainMenuItem = document.createElement('div');
			Dom.setStyle( mainMenuItem , 'position', 'relative');
			Dom.setStyle( mainMenuItem , 'float', 'left');
			Dom.setStyle( mainMenuItem , 'width', this._itemWidth+'px');
			Dom.setStyle( mainMenuItem , 'height', this._itemHeight+'px');
			
			// if it has a sub menu
			if( jsonMenu.subMenu )	{
				
				var menuList = new MenuList( jsonMenu.title, jsonMenu.subMenu, this._itemHeight,  this._itemWidth, this._animationDuration, this );
				mainMenuItem.appendChild( menuList.getContainer() );	
				
				this._mainMenuList[ index ] = menuList;
				
				var thisRef = this;
	            YAHOO.util.Event.addListener  (
	                    mainMenuItem ,
	                    'mouseover' ,
	                    function( e , index ) {
	                            thisRef.reportMouse(true);
	                            thisRef.showSubMenu(index);
	                            return false;
	                    } , index
	            );
	            YAHOO.util.Event.addListener  (
	                    mainMenuItem ,
	                    'mouseout' ,
	                    function( e , index ) {
	                            thisRef.reportMouse(false);
	                            return false;
	                    } , index
	            );
			}
			else	{
				
				Dom.setStyle( mainMenuItem, 'background-color', '#000000');
				mainMenuItem.innerHTML = 
					'<a href="'+jsonMenu.link+'" class="vudu-main-menu" >'+
					'<div><span>'+jsonMenu.title+'</span></div></a>';
					
				this._mainMenuList[ index ] = mainMenuItem;
			}
			
			return mainMenuItem;
		};
		
		this.showSubMenu = function( index )	{
			
			// if we are showing the menu list requested
			if( this._showingIndex == index )	{
				return;
			}
			
			// if this main menu item is a MenuList (has show)
			if( index >= 0 && this._mainMenuList[index].show )	{
				this._mainMenuList[index].show();
			}
			
			// if we have a sub menu showing - hide it
			if(this._showingIndex >= 0 && this._mainMenuList[this._showingIndex].hide )	{
				this._mainMenuList[this._showingIndex].hide();
			}
			
			this._showingIndex = index;
		}
	};
	
	
	
	
	MenuList = function( title , jsonMenuList , itemHeight , itemWidth , animationDuration , superclass )	{
			
		this._jsonMenuList = jsonMenuList;
		
		this._itemHeight = itemHeight || 30;
		
		this._itemWidth = itemWidth || 150;
		
		this._animationDuration = animationDuration || .25;
		
		this._superclass = superclass;
		
		this._container = null;
		
		this.menuItems = new Array(this._jsonMenuList.length);
		
		this._init = function()	{
			
			var Dom = YAHOO.util.Dom;
			
			this._container = document.createElement('div');
			Dom.setStyle( this._container , 'position', 'relative');
			Dom.setStyle( this._container , 'float', 'left');
			Dom.setStyle( this._container , 'width', this._itemWidth+'px');
			
			// loop for each of the menu items
			for(var  i = 0; i < this._jsonMenuList.length; i++ )    {
				
				var menuItem = new MenuItem( this._jsonMenuList[i], this._itemWidth, this._animationDuration, this._superclass );
				this.menuItems[i] = menuItem;
				this._container.appendChild( this.menuItems[i].getContainer() );
			}
			
			var cover = document.createElement('div');
			Dom.setStyle( cover , 'position', 'absolute');
			Dom.setStyle( cover , 'top', '0px');
			Dom.setStyle( cover , 'left', '0px');
			Dom.setStyle( cover , 'width', '100%');
			Dom.setStyle( cover , 'height', this._itemHeight+'px');
			Dom.setStyle( cover , 'background-color', '#000000');
			cover.innerHTML = 
				'<a href="javascript:highlight()" class="vudu-main-menu" >'+
				'<div><span>'+title+'</span></div></a>';
			
			this._container.appendChild(cover);
		};
		
		this.getContainer = function()	{
			return this._container;
		};
		
		this.show = function()	{
			
			for(var i = 0; i < this.menuItems.length; i++ )	{
				this.menuItems[i].show( this._itemHeight , i );
			}
		};
		
		this.hide = function()	{
			
			for(var i = 0; i < this.menuItems.length; i++ )	{
				this.menuItems[i].hide();
			}
		};
		
		this._init();
	};
	
	
	
	
	MenuItem = function( jsonMenuItem , itemWidth , animationDuration , superclass )	{
		
		this._container = null;
		
		this._itemWidth = itemWidth || 150;
		
		this._itemWidth = this._itemWidth  - 2;
		
		this._animationDuration = animationDuration || .25;
		
		this._jsonMenuItem = jsonMenuItem;
		
		this._superclass = superclass;
		
		this._init = function()	{
			
			var Dom = YAHOO.util.Dom;
			
			this._container = document.createElement('div');
			this._container.className = 'vudu-top-menu-border';
			
			Dom.setStyle( this._container , 'position', 'absolute');
			Dom.setStyle( this._container , 'top', '0px');
			Dom.setStyle( this._container , 'width', '100px');
			
			this._container.innerHTML = 
				'<a href="'+ (this._jsonMenuItem.link ? this._jsonMenuItem.link : '') +'" class="vudu-top-menu" >'+
				'<div><span>'+this._jsonMenuItem.title+'</span></div></a>';
			
			this._slide = new YAHOO.util.Anim( this._container );
			this._slide.duration = this._animationDuration;
			
			YAHOO.util.Event.addListener  (
					this._container ,
					'mouseover' ,
					function( e , superclass ) {
							superclass.reportMouse(true);
							return false;
					} , this._superclass
			);
			YAHOO.util.Event.addListener  (
					this._container ,
					'mouseout' ,
					function( e , superclass ) {
							superclass.reportMouse(false);
							return false;
					} , this._superclass
			);
			
			return this._container;
		};
		
		this.getContainer = function()	{
			return this._container;
		}
		
		this.show = function( offset, position )	{
			if(this._slide.isAnimated )	{
				this._slide.stop();
			}
			this._slide.attributes = { top : { to: (offset + (position * 25)) } };
			this._slide.animate();
		}
		this.hide = function()	{
			if(this._slide.isAnimated )	{
				this._slide.stop();
			}
			this._slide.attributes = { top : { to: 0 } };
			this._slide.animate();
		}
		
		this._init();
	};
})();

//creates a null href link for IE to make the cover menu a:hover work correctly
function highlight() {

	false;
	
	}

/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}A=B.match(/Caja\/([^\s]*)/);if(A&&A[1]){C.caja=parseFloat(A[1]);}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,F="[object Array]",C="[object Function]",A=Object.prototype,E=["toString","valueOf"],D={isArray:function(G){return A.toString.apply(G)===F;},isBoolean:function(G){return typeof G==="boolean";},isFunction:function(G){return A.toString.apply(G)===C;},isNull:function(G){return G===null;},isNumber:function(G){return typeof G==="number"&&isFinite(G);},isObject:function(G){return(G&&(typeof G==="object"||B.isFunction(G)))||false;},isString:function(G){return typeof G==="string";},isUndefined:function(G){return typeof G==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(I,H){var G,K,J;for(G=0;G<E.length;G=G+1){K=E[G];J=H[K];if(B.isFunction(J)&&J!=A[K]){I[K]=J;}}}:function(){},extend:function(J,K,I){if(!K||!J){throw new Error("extend failed, please check that "+"all dependencies are included.");}var H=function(){},G;H.prototype=K.prototype;J.prototype=new H();J.prototype.constructor=J;J.superclass=K.prototype;if(K.prototype.constructor==A.constructor){K.prototype.constructor=K;}if(I){for(G in I){if(B.hasOwnProperty(I,G)){J.prototype[G]=I[G];}}B._IEEnumFix(J.prototype,I);}},augmentObject:function(K,J){if(!J||!K){throw new Error("Absorb failed, verify dependencies.");}var G=arguments,I,L,H=G[2];if(H&&H!==true){for(I=2;I<G.length;I=I+1){K[G[I]]=J[G[I]];}}else{for(L in J){if(H||!(L in K)){K[L]=J[L];}}B._IEEnumFix(K,J);}},augmentProto:function(J,I){if(!I||!J){throw new Error("Augment failed, verify dependencies.");}var G=[J.prototype,I.prototype],H;for(H=2;H<arguments.length;H=H+1){G.push(arguments[H]);}B.augmentObject.apply(this,G);},dump:function(G,L){var I,K,N=[],O="{...}",H="f(){...}",M=", ",J=" => ";if(!B.isObject(G)){return G+"";}else{if(G instanceof Date||("nodeType" in G&&"tagName" in G)){return G;}else{if(B.isFunction(G)){return H;}}}L=(B.isNumber(L))?L:3;if(B.isArray(G)){N.push("[");for(I=0,K=G.length;I<K;I=I+1){if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}if(N.length>1){N.pop();}N.push("]");}else{N.push("{");for(I in G){if(B.hasOwnProperty(G,I)){N.push(I+J);if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}}if(N.length>1){N.pop();}N.push("}");}return N.join("");},substitute:function(V,H,O){var L,K,J,R,S,U,Q=[],I,M="dump",P=" ",G="{",T="}",N;for(;;){L=V.lastIndexOf(G);if(L<0){break;}K=V.indexOf(T,L);if(L+1>=K){break;}I=V.substring(L+1,K);R=I;U=null;J=R.indexOf(P);if(J>-1){U=R.substring(J+1);R=R.substring(0,J);}S=H[R];if(O){S=O(R,S,U);}if(B.isObject(S)){if(B.isArray(S)){S=B.dump(S,parseInt(U,10));}else{U=U||"";N=U.indexOf(M);if(N>-1){U=U.substring(4);}if(S.toString===A.toString||N>-1){S=B.dump(S,parseInt(U,10));}else{S=S.toString();}}}else{if(!B.isString(S)&&!B.isNumber(S)){S="~-"+Q.length+"-~";Q[Q.length]=I;}}V=V.substring(0,L)+S+V.substring(K+1);}for(L=Q.length-1;L>=0;L=L-1){V=V.replace(new RegExp("~-"+L+"-~"),"{"+Q[L]+"}","g");}return V;},trim:function(G){try{return G.replace(/^\s+|\s+$/g,"");}catch(H){return G;}},merge:function(){var J={},H=arguments,G=H.length,I;for(I=0;I<G;I=I+1){B.augmentObject(J,H[I],true);}return J;},later:function(N,H,O,J,K){N=N||0;H=H||{};var I=O,M=J,L,G;if(B.isString(O)){I=H[O];}if(!I){throw new TypeError("method undefined");}if(!B.isArray(M)){M=[J];}L=function(){I.apply(H,M);};G=(K)?setInterval(L,N):setTimeout(L,N);return{interval:K,cancel:function(){if(this.interval){clearInterval(G);}else{clearTimeout(G);}}};},isValue:function(G){return(B.isObject(G)||B.isString(G)||B.isNumber(G)||B.isBoolean(G));}};B.hasOwnProperty=(A.hasOwnProperty)?function(G,H){return G&&G.hasOwnProperty(H);}:function(G,H){return !B.isUndefined(G[H])&&G.constructor.prototype[H]!==G[H];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.7.0",build:"1799"});YAHOO.util.Get=function(){var M={},L=0,R=0,E=false,N=YAHOO.env.ua,S=YAHOO.lang;var J=function(W,T,X){var U=X||window,Y=U.document,Z=Y.createElement(W);for(var V in T){if(T[V]&&YAHOO.lang.hasOwnProperty(T,V)){Z.setAttribute(V,T[V]);}}return Z;};var I=function(T,U,W){var V=W||"utf-8";return J("link",{"id":"yui__dyn_"+(R++),"type":"text/css","charset":V,"rel":"stylesheet","href":T},U);
};var P=function(T,U,W){var V=W||"utf-8";return J("script",{"id":"yui__dyn_"+(R++),"type":"text/javascript","charset":V,"src":T},U);};var A=function(T,U){return{tId:T.tId,win:T.win,data:T.data,nodes:T.nodes,msg:U,purge:function(){D(this.tId);}};};var B=function(T,W){var U=M[W],V=(S.isString(T))?U.win.document.getElementById(T):T;if(!V){Q(W,"target node not found: "+T);}return V;};var Q=function(W,V){var T=M[W];if(T.onFailure){var U=T.scope||T.win;T.onFailure.call(U,A(T,V));}};var C=function(W){var T=M[W];T.finished=true;if(T.aborted){var V="transaction "+W+" was aborted";Q(W,V);return;}if(T.onSuccess){var U=T.scope||T.win;T.onSuccess.call(U,A(T));}};var O=function(V){var T=M[V];if(T.onTimeout){var U=T.scope||T;T.onTimeout.call(U,A(T));}};var G=function(V,Z){var U=M[V];if(U.timer){U.timer.cancel();}if(U.aborted){var X="transaction "+V+" was aborted";Q(V,X);return;}if(Z){U.url.shift();if(U.varName){U.varName.shift();}}else{U.url=(S.isString(U.url))?[U.url]:U.url;if(U.varName){U.varName=(S.isString(U.varName))?[U.varName]:U.varName;}}var c=U.win,b=c.document,a=b.getElementsByTagName("head")[0],W;if(U.url.length===0){if(U.type==="script"&&N.webkit&&N.webkit<420&&!U.finalpass&&!U.varName){var Y=P(null,U.win,U.charset);Y.innerHTML='YAHOO.util.Get._finalize("'+V+'");';U.nodes.push(Y);a.appendChild(Y);}else{C(V);}return;}var T=U.url[0];if(!T){U.url.shift();return G(V);}if(U.timeout){U.timer=S.later(U.timeout,U,O,V);}if(U.type==="script"){W=P(T,c,U.charset);}else{W=I(T,c,U.charset);}F(U.type,W,V,T,c,U.url.length);U.nodes.push(W);if(U.insertBefore){var e=B(U.insertBefore,V);if(e){e.parentNode.insertBefore(W,e);}}else{a.appendChild(W);}if((N.webkit||N.gecko)&&U.type==="css"){G(V,T);}};var K=function(){if(E){return;}E=true;for(var T in M){var U=M[T];if(U.autopurge&&U.finished){D(U.tId);delete M[T];}}E=false;};var D=function(a){var X=M[a];if(X){var Z=X.nodes,T=Z.length,Y=X.win.document,W=Y.getElementsByTagName("head")[0];if(X.insertBefore){var V=B(X.insertBefore,a);if(V){W=V.parentNode;}}for(var U=0;U<T;U=U+1){W.removeChild(Z[U]);}X.nodes=[];}};var H=function(U,T,V){var X="q"+(L++);V=V||{};if(L%YAHOO.util.Get.PURGE_THRESH===0){K();}M[X]=S.merge(V,{tId:X,type:U,url:T,finished:false,aborted:false,nodes:[]});var W=M[X];W.win=W.win||window;W.scope=W.scope||W.win;W.autopurge=("autopurge" in W)?W.autopurge:(U==="script")?true:false;S.later(0,W,G,X);return{tId:X};};var F=function(c,X,W,U,Y,Z,b){var a=b||G;if(N.ie){X.onreadystatechange=function(){var d=this.readyState;if("loaded"===d||"complete"===d){X.onreadystatechange=null;a(W,U);}};}else{if(N.webkit){if(c==="script"){if(N.webkit>=420){X.addEventListener("load",function(){a(W,U);});}else{var T=M[W];if(T.varName){var V=YAHOO.util.Get.POLL_FREQ;T.maxattempts=YAHOO.util.Get.TIMEOUT/V;T.attempts=0;T._cache=T.varName[0].split(".");T.timer=S.later(V,T,function(j){var f=this._cache,e=f.length,d=this.win,g;for(g=0;g<e;g=g+1){d=d[f[g]];if(!d){this.attempts++;if(this.attempts++>this.maxattempts){var h="Over retry limit, giving up";T.timer.cancel();Q(W,h);}else{}return;}}T.timer.cancel();a(W,U);},null,true);}else{S.later(YAHOO.util.Get.POLL_FREQ,null,a,[W,U]);}}}}else{X.onload=function(){a(W,U);};}}};return{POLL_FREQ:10,PURGE_THRESH:20,TIMEOUT:2000,_finalize:function(T){S.later(0,null,C,T);},abort:function(U){var V=(S.isString(U))?U:U.tId;var T=M[V];if(T){T.aborted=true;}},script:function(T,U){return H("script",T,U);},css:function(T,U){return H("css",T,U);}};}();YAHOO.register("get",YAHOO.util.Get,{version:"2.7.0",build:"1799"});(function(){var Y=YAHOO,util=Y.util,lang=Y.lang,env=Y.env,PROV="_provides",SUPER="_supersedes",REQ="expanded",AFTER="_after";var YUI={dupsAllowed:{"yahoo":true,"get":true},info:{"root":"2.7.0/build/","base":"http://yui.yahooapis.com/2.7.0/build/","comboBase":"http://yui.yahooapis.com/combo?","skin":{"defaultSkin":"sam","base":"assets/skins/","path":"skin.css","after":["reset","fonts","grids","base"],"rollup":3},dupsAllowed:["yahoo","get"],"moduleInfo":{"animation":{"type":"js","path":"animation/animation-min.js","requires":["dom","event"]},"autocomplete":{"type":"js","path":"autocomplete/autocomplete-min.js","requires":["dom","event","datasource"],"optional":["connection","animation"],"skinnable":true},"base":{"type":"css","path":"base/base-min.css","after":["reset","fonts","grids"]},"button":{"type":"js","path":"button/button-min.js","requires":["element"],"optional":["menu"],"skinnable":true},"calendar":{"type":"js","path":"calendar/calendar-min.js","requires":["event","dom"],"skinnable":true},"carousel":{"type":"js","path":"carousel/carousel-min.js","requires":["element"],"optional":["animation"],"skinnable":true},"charts":{"type":"js","path":"charts/charts-min.js","requires":["element","json","datasource"]},"colorpicker":{"type":"js","path":"colorpicker/colorpicker-min.js","requires":["slider","element"],"optional":["animation"],"skinnable":true},"connection":{"type":"js","path":"connection/connection-min.js","requires":["event"]},"container":{"type":"js","path":"container/container-min.js","requires":["dom","event"],"optional":["dragdrop","animation","connection"],"supersedes":["containercore"],"skinnable":true},"containercore":{"type":"js","path":"container/container_core-min.js","requires":["dom","event"],"pkg":"container"},"cookie":{"type":"js","path":"cookie/cookie-min.js","requires":["yahoo"]},"datasource":{"type":"js","path":"datasource/datasource-min.js","requires":["event"],"optional":["connection"]},"datatable":{"type":"js","path":"datatable/datatable-min.js","requires":["element","datasource"],"optional":["calendar","dragdrop","paginator"],"skinnable":true},"dom":{"type":"js","path":"dom/dom-min.js","requires":["yahoo"]},"dragdrop":{"type":"js","path":"dragdrop/dragdrop-min.js","requires":["dom","event"]},"editor":{"type":"js","path":"editor/editor-min.js","requires":["menu","element","button"],"optional":["animation","dragdrop"],"supersedes":["simpleeditor"],"skinnable":true},"element":{"type":"js","path":"element/element-min.js","requires":["dom","event"]},"event":{"type":"js","path":"event/event-min.js","requires":["yahoo"]},"fonts":{"type":"css","path":"fonts/fonts-min.css"},"get":{"type":"js","path":"get/get-min.js","requires":["yahoo"]},"grids":{"type":"css","path":"grids/grids-min.css","requires":["fonts"],"optional":["reset"]},"history":{"type":"js","path":"history/history-min.js","requires":["event"]},"imagecropper":{"type":"js","path":"imagecropper/imagecropper-min.js","requires":["dom","event","dragdrop","element","resize"],"skinnable":true},"imageloader":{"type":"js","path":"imageloader/imageloader-min.js","requires":["event","dom"]},"json":{"type":"js","path":"json/json-min.js","requires":["yahoo"]},"layout":{"type":"js","path":"layout/layout-min.js","requires":["dom","event","element"],"optional":["animation","dragdrop","resize","selector"],"skinnable":true},"logger":{"type":"js","path":"logger/logger-min.js","requires":["event","dom"],"optional":["dragdrop"],"skinnable":true},"menu":{"type":"js","path":"menu/menu-min.js","requires":["containercore"],"skinnable":true},"paginator":{"type":"js","path":"paginator/paginator-min.js","requires":["element"],"skinnable":true},"profiler":{"type":"js","path":"profiler/profiler-min.js","requires":["yahoo"]},"profilerviewer":{"type":"js","path":"profilerviewer/profilerviewer-min.js","requires":["profiler","yuiloader","element"],"skinnable":true},"reset":{"type":"css","path":"reset/reset-min.css"},"reset-fonts-grids":{"type":"css","path":"reset-fonts-grids/reset-fonts-grids.css","supersedes":["reset","fonts","grids","reset-fonts"],"rollup":4},"reset-fonts":{"type":"css","path":"reset-fonts/reset-fonts.css","supersedes":["reset","fonts"],"rollup":2},"resize":{"type":"js","path":"resize/resize-min.js","requires":["dom","event","dragdrop","element"],"optional":["animation"],"skinnable":true},"selector":{"type":"js","path":"selector/selector-min.js","requires":["yahoo","dom"]},"simpleeditor":{"type":"js","path":"editor/simpleeditor-min.js","requires":["element"],"optional":["containercore","menu","button","animation","dragdrop"],"skinnable":true,"pkg":"editor"},"slider":{"type":"js","path":"slider/slider-min.js","requires":["dragdrop"],"optional":["animation"],"skinnable":true},"stylesheet":{"type":"js","path":"stylesheet/stylesheet-min.js","requires":["yahoo"]},"tabview":{"type":"js","path":"tabview/tabview-min.js","requires":["element"],"optional":["connection"],"skinnable":true},"treeview":{"type":"js","path":"treeview/treeview-min.js","requires":["event","dom"],"optional":["json"],"skinnable":true},"uploader":{"type":"js","path":"uploader/uploader.js","requires":["element"]},"utilities":{"type":"js","path":"utilities/utilities.js","supersedes":["yahoo","event","dragdrop","animation","dom","connection","element","yahoo-dom-event","get","yuiloader","yuiloader-dom-event"],"rollup":8},"yahoo":{"type":"js","path":"yahoo/yahoo-min.js"},"yahoo-dom-event":{"type":"js","path":"yahoo-dom-event/yahoo-dom-event.js","supersedes":["yahoo","event","dom"],"rollup":3},"yuiloader":{"type":"js","path":"yuiloader/yuiloader-min.js","supersedes":["yahoo","get"]},"yuiloader-dom-event":{"type":"js","path":"yuiloader-dom-event/yuiloader-dom-event.js","supersedes":["yahoo","dom","event","get","yuiloader","yahoo-dom-event"],"rollup":5},"yuitest":{"type":"js","path":"yuitest/yuitest-min.js","requires":["logger"],"skinnable":true}}},ObjectUtil:{appendArray:function(o,a){if(a){for(var i=0;
i<a.length;i=i+1){o[a[i]]=true;}}},keys:function(o,ordered){var a=[],i;for(i in o){if(lang.hasOwnProperty(o,i)){a.push(i);}}return a;}},ArrayUtil:{appendArray:function(a1,a2){Array.prototype.push.apply(a1,a2);},indexOf:function(a,val){for(var i=0;i<a.length;i=i+1){if(a[i]===val){return i;}}return -1;},toObject:function(a){var o={};for(var i=0;i<a.length;i=i+1){o[a[i]]=true;}return o;},uniq:function(a){return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));}}};YAHOO.util.YUILoader=function(o){this._internalCallback=null;this._useYahooListener=false;this.onSuccess=null;this.onFailure=Y.log;this.onProgress=null;this.onTimeout=null;this.scope=this;this.data=null;this.insertBefore=null;this.charset=null;this.varName=null;this.base=YUI.info.base;this.comboBase=YUI.info.comboBase;this.combine=false;this.root=YUI.info.root;this.timeout=0;this.ignore=null;this.force=null;this.allowRollup=true;this.filter=null;this.required={};this.moduleInfo=lang.merge(YUI.info.moduleInfo);this.rollups=null;this.loadOptional=false;this.sorted=[];this.loaded={};this.dirty=true;this.inserted={};var self=this;env.listeners.push(function(m){if(self._useYahooListener){self.loadNext(m.name);}});this.skin=lang.merge(YUI.info.skin);this._config(o);};Y.util.YUILoader.prototype={FILTERS:{RAW:{"searchExp":"-min\\.js","replaceStr":".js"},DEBUG:{"searchExp":"-min\\.js","replaceStr":"-debug.js"}},SKIN_PREFIX:"skin-",_config:function(o){if(o){for(var i in o){if(lang.hasOwnProperty(o,i)){if(i=="require"){this.require(o[i]);}else{this[i]=o[i];}}}}var f=this.filter;if(lang.isString(f)){f=f.toUpperCase();if(f==="DEBUG"){this.require("logger");}if(!Y.widget.LogWriter){Y.widget.LogWriter=function(){return Y;};}this.filter=this.FILTERS[f];}},addModule:function(o){if(!o||!o.name||!o.type||(!o.path&&!o.fullpath)){return false;}o.ext=("ext" in o)?o.ext:true;o.requires=o.requires||[];this.moduleInfo[o.name]=o;this.dirty=true;return true;},require:function(what){var a=(typeof what==="string")?arguments:what;this.dirty=true;YUI.ObjectUtil.appendArray(this.required,a);},_addSkin:function(skin,mod){var name=this.formatSkin(skin),info=this.moduleInfo,sinf=this.skin,ext=info[mod]&&info[mod].ext;if(!info[name]){this.addModule({"name":name,"type":"css","path":sinf.base+skin+"/"+sinf.path,"after":sinf.after,"rollup":sinf.rollup,"ext":ext});}if(mod){name=this.formatSkin(skin,mod);if(!info[name]){var mdef=info[mod],pkg=mdef.pkg||mod;this.addModule({"name":name,"type":"css","after":sinf.after,"path":pkg+"/"+sinf.base+skin+"/"+mod+".css","ext":ext});}}return name;},getRequires:function(mod){if(!mod){return[];}if(!this.dirty&&mod.expanded){return mod.expanded;}mod.requires=mod.requires||[];var i,d=[],r=mod.requires,o=mod.optional,info=this.moduleInfo,m;for(i=0;i<r.length;i=i+1){d.push(r[i]);m=info[r[i]];YUI.ArrayUtil.appendArray(d,this.getRequires(m));}if(o&&this.loadOptional){for(i=0;i<o.length;i=i+1){d.push(o[i]);YUI.ArrayUtil.appendArray(d,this.getRequires(info[o[i]]));}}mod.expanded=YUI.ArrayUtil.uniq(d);return mod.expanded;},getProvides:function(name,notMe){var addMe=!(notMe),ckey=(addMe)?PROV:SUPER,m=this.moduleInfo[name],o={};if(!m){return o;}if(m[ckey]){return m[ckey];}var s=m.supersedes,done={},me=this;var add=function(mm){if(!done[mm]){done[mm]=true;lang.augmentObject(o,me.getProvides(mm));}};if(s){for(var i=0;i<s.length;i=i+1){add(s[i]);}}m[SUPER]=o;m[PROV]=lang.merge(o);m[PROV][name]=true;return m[ckey];},calculate:function(o){if(o||this.dirty){this._config(o);this._setup();this._explode();if(this.allowRollup){this._rollup();}this._reduce();this._sort();this.dirty=false;}},_setup:function(){var info=this.moduleInfo,name,i,j;for(name in info){if(lang.hasOwnProperty(info,name)){var m=info[name];if(m&&m.skinnable){var o=this.skin.overrides,smod;if(o&&o[name]){for(i=0;i<o[name].length;i=i+1){smod=this._addSkin(o[name][i],name);}}else{smod=this._addSkin(this.skin.defaultSkin,name);}m.requires.push(smod);}}}var l=lang.merge(this.inserted);if(!this._sandbox){l=lang.merge(l,env.modules);}if(this.ignore){YUI.ObjectUtil.appendArray(l,this.ignore);}if(this.force){for(i=0;i<this.force.length;i=i+1){if(this.force[i] in l){delete l[this.force[i]];}}}for(j in l){if(lang.hasOwnProperty(l,j)){lang.augmentObject(l,this.getProvides(j));}}this.loaded=l;},_explode:function(){var r=this.required,i,mod;for(i in r){if(lang.hasOwnProperty(r,i)){mod=this.moduleInfo[i];if(mod){var req=this.getRequires(mod);if(req){YUI.ObjectUtil.appendArray(r,req);}}}}},_skin:function(){},formatSkin:function(skin,mod){var s=this.SKIN_PREFIX+skin;if(mod){s=s+"-"+mod;}return s;},parseSkin:function(mod){if(mod.indexOf(this.SKIN_PREFIX)===0){var a=mod.split("-");return{skin:a[1],module:a[2]};}return null;},_rollup:function(){var i,j,m,s,rollups={},r=this.required,roll,info=this.moduleInfo;if(this.dirty||!this.rollups){for(i in info){if(lang.hasOwnProperty(info,i)){m=info[i];if(m&&m.rollup){rollups[i]=m;}}}this.rollups=rollups;}for(;;){var rolled=false;for(i in rollups){if(!r[i]&&!this.loaded[i]){m=info[i];s=m.supersedes;roll=false;if(!m.rollup){continue;}var skin=(m.ext)?false:this.parseSkin(i),c=0;if(skin){for(j in r){if(lang.hasOwnProperty(r,j)){if(i!==j&&this.parseSkin(j)){c++;roll=(c>=m.rollup);if(roll){break;}}}}}else{for(j=0;j<s.length;j=j+1){if(this.loaded[s[j]]&&(!YUI.dupsAllowed[s[j]])){roll=false;break;}else{if(r[s[j]]){c++;roll=(c>=m.rollup);if(roll){break;}}}}}if(roll){r[i]=true;rolled=true;this.getRequires(m);}}}if(!rolled){break;}}},_reduce:function(){var i,j,s,m,r=this.required;for(i in r){if(i in this.loaded){delete r[i];}else{var skinDef=this.parseSkin(i);if(skinDef){if(!skinDef.module){var skin_pre=this.SKIN_PREFIX+skinDef.skin;for(j in r){if(lang.hasOwnProperty(r,j)){m=this.moduleInfo[j];var ext=m&&m.ext;if(!ext&&j!==i&&j.indexOf(skin_pre)>-1){delete r[j];}}}}}else{m=this.moduleInfo[i];s=m&&m.supersedes;if(s){for(j=0;j<s.length;j=j+1){if(s[j] in r){delete r[s[j]];}}}}}}},_onFailure:function(msg){YAHOO.log("Failure","info","loader");var f=this.onFailure;if(f){f.call(this.scope,{msg:"failure: "+msg,data:this.data,success:false});
}},_onTimeout:function(){YAHOO.log("Timeout","info","loader");var f=this.onTimeout;if(f){f.call(this.scope,{msg:"timeout",data:this.data,success:false});}},_sort:function(){var s=[],info=this.moduleInfo,loaded=this.loaded,checkOptional=!this.loadOptional,me=this;var requires=function(aa,bb){var mm=info[aa];if(loaded[bb]||!mm){return false;}var ii,rr=mm.expanded,after=mm.after,other=info[bb],optional=mm.optional;if(rr&&YUI.ArrayUtil.indexOf(rr,bb)>-1){return true;}if(after&&YUI.ArrayUtil.indexOf(after,bb)>-1){return true;}if(checkOptional&&optional&&YUI.ArrayUtil.indexOf(optional,bb)>-1){return true;}var ss=info[bb]&&info[bb].supersedes;if(ss){for(ii=0;ii<ss.length;ii=ii+1){if(requires(aa,ss[ii])){return true;}}}if(mm.ext&&mm.type=="css"&&!other.ext&&other.type=="css"){return true;}return false;};for(var i in this.required){if(lang.hasOwnProperty(this.required,i)){s.push(i);}}var p=0;for(;;){var l=s.length,a,b,j,k,moved=false;for(j=p;j<l;j=j+1){a=s[j];for(k=j+1;k<l;k=k+1){if(requires(a,s[k])){b=s.splice(k,1);s.splice(j,0,b[0]);moved=true;break;}}if(moved){break;}else{p=p+1;}}if(!moved){break;}}this.sorted=s;},toString:function(){var o={type:"YUILoader",base:this.base,filter:this.filter,required:this.required,loaded:this.loaded,inserted:this.inserted};lang.dump(o,1);},_combine:function(){this._combining=[];var self=this,s=this.sorted,len=s.length,js=this.comboBase,css=this.comboBase,target,startLen=js.length,i,m,type=this.loadType;YAHOO.log("type "+type);for(i=0;i<len;i=i+1){m=this.moduleInfo[s[i]];if(m&&!m.ext&&(!type||type===m.type)){target=this.root+m.path;target+="&";if(m.type=="js"){js+=target;}else{css+=target;}this._combining.push(s[i]);}}if(this._combining.length){YAHOO.log("Attempting to combine: "+this._combining,"info","loader");var callback=function(o){var c=this._combining,len=c.length,i,m;for(i=0;i<len;i=i+1){this.inserted[c[i]]=true;}this.loadNext(o.data);},loadScript=function(){if(js.length>startLen){YAHOO.util.Get.script(self._filter(js),{data:self._loading,onSuccess:callback,onFailure:self._onFailure,onTimeout:self._onTimeout,insertBefore:self.insertBefore,charset:self.charset,timeout:self.timeout,scope:self});}};if(css.length>startLen){YAHOO.util.Get.css(this._filter(css),{data:this._loading,onSuccess:loadScript,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,scope:self});}else{loadScript();}return;}else{this.loadNext(this._loading);}},insert:function(o,type){this.calculate(o);this._loading=true;this.loadType=type;if(this.combine){return this._combine();}if(!type){var self=this;this._internalCallback=function(){self._internalCallback=null;self.insert(null,"js");};this.insert(null,"css");return;}this.loadNext();},sandbox:function(o,type){this._config(o);if(!this.onSuccess){throw new Error("You must supply an onSuccess handler for your sandbox");}this._sandbox=true;var self=this;if(!type||type!=="js"){this._internalCallback=function(){self._internalCallback=null;self.sandbox(null,"js");};this.insert(null,"css");return;}if(!util.Connect){var ld=new YAHOO.util.YUILoader();ld.insert({base:this.base,filter:this.filter,require:"connection",insertBefore:this.insertBefore,charset:this.charset,onSuccess:function(){this.sandbox(null,"js");},scope:this},"js");return;}this._scriptText=[];this._loadCount=0;this._stopCount=this.sorted.length;this._xhr=[];this.calculate();var s=this.sorted,l=s.length,i,m,url;for(i=0;i<l;i=i+1){m=this.moduleInfo[s[i]];if(!m){this._onFailure("undefined module "+m);for(var j=0;j<this._xhr.length;j=j+1){this._xhr[j].abort();}return;}if(m.type!=="js"){this._loadCount++;continue;}url=m.fullpath;url=(url)?this._filter(url):this._url(m.path);var xhrData={success:function(o){var idx=o.argument[0],name=o.argument[2];this._scriptText[idx]=o.responseText;if(this.onProgress){this.onProgress.call(this.scope,{name:name,scriptText:o.responseText,xhrResponse:o,data:this.data});}this._loadCount++;if(this._loadCount>=this._stopCount){var v=this.varName||"YAHOO";var t="(function() {\n";var b="\nreturn "+v+";\n})();";var ref=eval(t+this._scriptText.join("\n")+b);this._pushEvents(ref);if(ref){this.onSuccess.call(this.scope,{reference:ref,data:this.data});}else{this._onFailure.call(this.varName+" reference failure");}}},failure:function(o){this.onFailure.call(this.scope,{msg:"XHR failure",xhrResponse:o,data:this.data});},scope:this,argument:[i,url,s[i]]};this._xhr.push(util.Connect.asyncRequest("GET",url,xhrData));}},loadNext:function(mname){if(!this._loading){return;}if(mname){if(mname!==this._loading){return;}this.inserted[mname]=true;if(this.onProgress){this.onProgress.call(this.scope,{name:mname,data:this.data});}}var s=this.sorted,len=s.length,i,m;for(i=0;i<len;i=i+1){if(s[i] in this.inserted){continue;}if(s[i]===this._loading){return;}m=this.moduleInfo[s[i]];if(!m){this.onFailure.call(this.scope,{msg:"undefined module "+m,data:this.data});return;}if(!this.loadType||this.loadType===m.type){this._loading=s[i];var fn=(m.type==="css")?util.Get.css:util.Get.script,url=m.fullpath,self=this,c=function(o){self.loadNext(o.data);};url=(url)?this._filter(url):this._url(m.path);if(env.ua.webkit&&env.ua.webkit<420&&m.type==="js"&&!m.varName){c=null;this._useYahooListener=true;}fn(url,{data:s[i],onSuccess:c,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,varName:m.varName,scope:self});return;}}this._loading=null;if(this._internalCallback){var f=this._internalCallback;this._internalCallback=null;f.call(this);}else{if(this.onSuccess){this._pushEvents();this.onSuccess.call(this.scope,{data:this.data});}}},_pushEvents:function(ref){var r=ref||YAHOO;if(r.util&&r.util.Event){r.util.Event._load();}},_filter:function(str){var f=this.filter;return(f)?str.replace(new RegExp(f.searchExp,"g"),f.replaceStr):str;},_url:function(path){return this._filter((this.base||"")+path);}};})();YAHOO.register("yuiloader",YAHOO.util.YUILoader,{version:"2.7.0",build:"1799"});
	