Community = new function(){}

Community.Page = new function(){	
this.noHat = false;
this.hostname = window.location.hostname;
this.path = window.location.pathname;
this.qs = window.location.search.substring(1);
this.vars = this.qs.split("&");
this.baseUrl = (this.hostname.indexOf("mtv-q.mtvi.com") > 0) ? "http://www.mtv-d.mtvi.com" : "http://www.mtv.com";
this.headTag = document.getElementsByTagName("head").item(0);
this.cssOverrideSet = false;

this.isFN = false;

this.init = function(){

Community.Page.updatePage();

Community.Widgets.createFooter('MTVFooter');

if(Community.Page.isFN){
Community.Widgets.createNav('MTVNav', Community.Widgets.fnHeaderObj);
}
else{
/*
Community.Widgets.createArtistlist('MTVArtistList');
Community.Widgets.createSearch('MTVSearch');
Community.Widgets.createNav('MTVNav');
*/
Community.Widgets.createNav('nav');
}
}

this.createScript = function(url){
var scriptObj = document.createElement("script");
scriptObj.setAttribute("type", "text/javascript");
scriptObj.setAttribute("src", Community.Page.baseUrl+url);

Community.Page.headTag.appendChild(scriptObj);
}

this.setHat = function(hatNumber, subset){
if (!(typeof wpTemplatePage == "undefined") && wpTemplatePage) {
return;
}
function hatTrick(hatNumber, subset) {
var total = 66;
var bodyTag = document.getElementsByTagName('body')[0];
var classList = bodyTag.className;
if (classList.indexOf("hat") > -1) {
var tempClasses = new Array();
var classes = classList.split(" ");
var j = 0;
for(i = 0; i < classes.length; i++) {
if(classes[i].substr(0,3) != "hat") tempClasses[j++] = classes[i];
}
classList = tempClasses.join(" ");
}

if (!hatNumber) hatNumber = Math.floor(total*Math.random());
var newHat = " hat" + hatNumber;
bodyTag.className = classList + newHat + "";
}
hatTrick(hatNumber, subset);
}

this.setDiscussionCSS = function(){
var tcId = "";

for (var i=0; i<Community.Page.vars.length; i++) {
var pair = Community.Page.vars[i].split("=");
if (pair[0] == "tcid" || pair[0] == "tcId") {
tcId = pair[1];
} 
}

if(tcId!==''){
var categories = Community.Data.discussionCategories;

for(var i=0; i<categories.length; i++){
if(categories[i].id==tcId){
if(typeof categories[i].css == 'string'){
Community.Page.addCSSLink(categories[i].css);
Community.Page.cssOverrideSet = true;
}	
}
}
}	

if(!Community.Page.cssOverrideSet) Community.Page.setHat();
}

this.addCSSLink = function(url){
var cssUrl = Community.Page.baseUrl + url;
var linkObj = document.createElement("link");

linkObj.setAttribute("rel", "stylesheet");
linkObj.setAttribute("type", "text/css");
linkObj.setAttribute("href", cssUrl);

Community.Page.headTag.appendChild(linkObj);
}

this.handleFnVideoCategory = function(response){
var categories = response.categories.category
var category = "";

for (var i=0; i<Community.Page.vars.length; i++) {
var pair = Community.Page.vars[i].split("=");
if (pair[0] == "category") {
category = pair[1];
} 
}

for(var i=0; i<categories.length; i++){
if(categories[i].id==category){
Community.Page.isFN = true;
Community.Page.addCSSLink('/ontv/fn-mtv/css/hosted_pages.css');
Community.Page.cssOverrideSet = true;
Community.Data.fnVideoCategory = categories[i];
}
}
if(!Community.Page.cssOverrideSet) Community.Page.setHat();
}

this.updatePage = function(){	
// fn video category pages
if(Community.Data.fnVideoCategory!="" && document.getElementById("ctl01_ctl00_ctl00_phBody_phBody_phBody_ctl00_ctl01_divAddModuleArea")==null){	
var category = Community.Data.fnVideoCategory;
var fnHeader = document.createElement("div");
fnHeader.className = "fn-header";

var h1 = document.createElement("h1");
h1.innerHTML = "FN Uploads <em> | " + category.name + "</em>";
h1.className = "main-title"

var img = document.createElement("img");
img.className = "thumb";
img.setAttribute("src", Community.Page.baseUrl + category.images.img.src);

var div = document.createElement("div");
div.className = "deck";

if(category.description!=null){
var p = document.createElement("p");
p.appendChild(document.createTextNode(category.description));
div.appendChild(p);
}

var action = document.createElement("a");
action.className = "action";
action.setAttribute("href", Community.Page.baseUrl + "/ontv/fn-mtv/uploads.jhtml");
action.appendChild(document.createTextNode("Back to all uploads categories"));
div.appendChild(action);

if(category.videoId!=null){
var button = document.createElement("a");
button.setAttribute("href", Community.Page.baseUrl + "/ontv/fn-mtv/upload.jhtml?categoryId=" + category.id);
button.innerHTML = "<" + "img src=\"" + Community.Page.baseUrl + "/content/ontv/fn-mtv/images/bttn-upload-to-category.gif\"/>";
div.appendChild(button);	
}

fnHeader.appendChild(h1);	
fnHeader.appendChild(img);
fnHeader.appendChild(div);

var zone = document.getElementById("ctl01_ctl00_ctl00_phBody_phBody_phBody_ctl00_zone2_zone2");	
zone.insertBefore(fnHeader, zone.childNodes[0]);

}// fn video category pages

// trim non-community greeting
if(!document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_quickMenu_pnlCommunityMember')){
var q = document.getElementById('quickmenu');
if (q) {
var spans = q.getElementsByTagName('span');
var container;

for (var x=0; x<spans.length; x++){
if (spans[x].className.indexOf("userGreetingContainer") == 0) container = spans[x];
}

if(container){
for (var i=0; i<container.childNodes.length; i++){
var element = container.childNodes[i];
if(element.nodeName!='BR' && (!element.className || element.className.indexOf("userGreeting") < 0)) container.replaceChild(document.createTextNode(''), element);
}
}
}	
}

// trim friend request text
var pnlDelimiter = document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_quickMenu1_pnlDelimiter');
if(pnlDelimiter){
for (var i=0; i<pnlDelimiter.childNodes.length; i++){
var element = pnlDelimiter.childNodes[i];
if(element.nodeName=='#text'){
if(element.nodeValue.indexOf('||') >= 0){
pnlDelimiter.replaceChild(document.createTextNode(' | '), element);
}
else pnlDelimiter.removeChild(element);
}
}
}

// add User Search link to Friends page
if(Community.Page.path.indexOf('FriendsManagement.aspx') > 0 || Community.Page.path.indexOf('FriendsManagment.aspx') > 0){
var inviteLink = document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_phBody_cFriendManagement_btnReorderFriends');

if(inviteLink){
var tbody = inviteLink.parentNode.parentNode.parentNode;
var newTR = document.createElement('tr');

var newTD = document.createElement('td');
newTD.setAttribute('align', 'right');

var newA = document.createElement('a');
newA.setAttribute('href', '/-/Community/BrowseUsers.aspx'); 
newA.appendChild(document.createTextNode('Browse Members'));

newTD.appendChild(newA);
newTR.appendChild(document.createElement('td'));
newTR.appendChild(newTD);
tbody.appendChild(newTR);
}
}// end user search

// add Upload links to Feed Detail pages
if(Community.Page.path.indexOf('/Content/Picture/Pictures.aspx') >0 || Community.Page.path.indexOf('/Content/Video/Videos.aspx') > 0){
var contentType;
if(Community.Page.path.indexOf('/Content/Picture/Pictures.aspx') >0) contentType = 'photo';
else if(Community.Page.path.indexOf('/Content/Video/Videos.aspx') >0) contentType = 'video';

var hook = document.getElementById('ctl01_ctl00_ctl00_phBody_phBody_phBody_contentFilterControl_lbPersonal');

if(hook){
var sidebar = hook.parentNode.parentNode.parentNode.parentNode;

var a = document.createElement('a');
var text;

switch(contentType){
case 'video': 
a.setAttribute('href', '/-/Content/Video/AddVideo.aspx');
text = 'Upload Videos';
break;
case 'photo': 
a.setAttribute('href', '/-/Content/Picture/AddPhoto.aspx');
text = 'Upload Photos';
break;
default: break;
}	
a.appendChild(document.createTextNode(text));

sidebar.appendChild(a);
}
}// end upload links

// discussion boards breadcrumb
if(Community.Page.path.indexOf('DiscussionResults.aspx') > 0 && (Community.Page.qs.indexOf('tcid') >= 0 || Community.Page.qs.indexOf('tcId') >= 0)){
var tcid = "";

for (var i=0; i<Community.Page.vars.length; i++) {
var pair = Community.Page.vars[i].split("=");
if (pair[0] == "tcid" || pair[0] == "tcId") {
tcid = pair[1];
} 
}

var categories = Community.Data.discussionCategories;

for(var i=0; i<categories.length; i++){
if(categories[i].id==tcid){
var breadcrumb = document.getElementById("breadcrumb");

breadcrumb.href = Community.Page.baseUrl + categories[i].link.args;

var newChild = document.createTextNode(categories[i].link.content);
var oldChild = breadcrumb.childNodes[0];
breadcrumb.replaceChild(newChild, oldChild);
}
}

}// end discussion boards breadcrumb

if(Community.Page.path.indexOf('Topic') > 0){	
var breadcrumb = "";
var catId = "";

var tds = document.getElementsByTagName("td");

for(var i=0; i<tds.length; i++){
if(tds[i].id.indexOf('fluxBreadCrumbs_rptBreadCrumbs_ctl01_tdBreadCrumbCell') > 0){
breadcrumb = tds[i].getElementsByTagName("a")[0];
}
if(tds[i].id.indexOf('fluxBreadCrumbs_rptBreadCrumbs_ctl03_tdBreadCrumbCell') > 0){
var categoryLink = tds[i].getElementsByTagName("a")[0].href;
catId = categoryLink.substring(categoryLink.indexOf("catId=")+6, categoryLink.length);
}
}

var categories = Community.Data.discussionCategories;
for(var i=0; i<categories.length; i++){
if(categories[i].id==catId){
breadcrumb.href = Community.Page.baseUrl + categories[i].link.args;

var newChild = document.createTextNode(categories[i].link.content);
var oldChild = breadcrumb.childNodes[0];
breadcrumb.replaceChild(newChild, oldChild);
}
}
}

}// end this.updatePage

}

Community.Data = new function(){
this.discussionCategories = "";
this.fnVideoCategory = "";

this.setDiscussionCategories = function(obj){
Community.Data.discussionCategories = obj.categories.category;
Community.Page.setDiscussionCSS();
}
}

Community.Widgets = new function(){

if( window.location.hostname.indexOf("mtv-d.mtvi.com") != -1 ) {
this.baseUrl = 'http://www.mtv-d.mtvi.com';
} else if (window.location.hostname.indexOf("mtv-q.mtvi.com") != -1 ) {
this.baseUrl = 'http://www.mtv-q.mtvi.com';
} else {
this.baseUrl = 'http://www.mtv.com';
}

this.hostname = 'http://www.mtv.com';

this.headerObj = {"div":{"div":[{"div":[{"a":[{"href":"http://www.mtv.com","class":"first","content":"Home"},{"href":"http://labsblog.mtv.com/2009/09/02/mtvcom-home-page-and-navigation-change/","target":"_blank","class":"last","content":"New Homepage Feedback"}],"class":"memberbarlinks"},{"code":{"class":"hide"},"class":"fluxWidget","id":"wQuickMenu"}],"ul":{"li":{"a":{"href":"#","class":"topLink","content":"MTV Sites"},"ul":{"li":[{"a":{"href":"http://www.mtv.com","content":"MTV"},"class":"subLevel"},{"a":{"href":"http://www.mtv2.com","content":"MTV2"},"class":"subLevel"},{"a":{"href":"http://www.mtvtr3s.com","content":"MTV Tr3s"},"class":"subLevel"},{"a":{"href":"http://www.mtvu.com","content":"mtvU"},"class":"subLevel"},{"a":{"href":"http://www.mtviggy.com","content":"MTV Iggy"},"class":"subLevel"},{"a":{"href":"http://www.thinkmtv.com","content":"Think MTV"},"class":"subLevel"},{"a":{"href":"http://www.mtv.com/directory/","content":"All MTV Sites"},"class":"subLevel"}]},"class":"topLevel"},"id":"mtvSitesNav"},"id":"memberbar"},{"a":{"href":"/","content":"mtv"},"id":"mtvLogo"},{"class":"navLogoToolTip","content":"MTV Home"},{"form":{"input":{"value":"SEARCH","type":"text","onkeypress":"catchEnter(this.form, event);","onclick":"this.value='';","name":"searchterm","id":"searchmtv-text"},"action":"/search/","onsubmit":"return false;","name":"search","button":[{"content":"GO","onclick":"submitSearch(this.form, 0); return false;","id":"searchmtv-btn"},{"content":"WEB","onclick":"submitSearch(this.form, 1); return false;","id":"searchweb-btn"}],"method":"get"},"id":"searchmtv"}],"ul":[{"li":[{"a":{"href":"/music/video/","content":"music videos"},"class":"first"},{"a":{"href":"/videos/home.jhtml","content":"full episodes"},"class":""},{"a":{"href":"/ontv/schedule/","content":"tv schedule"},"class":""},{"a":{"href":"/music/artists/browse.jhtml?chars=a","content":"browse artists a-z"},"class":""},{"a":{"href":"/movies/trailer_park/","content":"movie trailers"},"class":""},{"a":{"href":"/music/radio/","content":"radio"},"class":""},{"a":{"href":"/games/arcade/","content":"online games"},"class":""},{"a":{"href":"/mobile/","content":"mobile"},"class":""}],"id":"topnavLinks"},{"li":[{"a":{"href":"http://www.mtv.com/music/","class":"n-link music","content":"Music","id":"music"},"ul":{"class":"gridContainer","li":{"div":{"ul":[{"class":"gridMain","li":[{"a":{"href":"/music/","content":"Music Main"}},{"a":{"href":"/music/artists/browse.jhtml?chars=a","content":"All Artists"}},{"a":{"href":"http://buzzworthy.mtv.com/","content":"Buzzworthy Music Blog"}},{"a":{"href":"/news/#music/","content":"Music News"},"id":"newsMain2Tab"},{"a":{"href":"/music/radio/","content":"Radio"}},{"a":{"href":"/lyrics/","content":"Lyrics"}},{"a":{"href":"http://community.mtvmusic.com/top100/","target":"_blank","content":"Video Charts"}},{"a":{"href":"/music/artists/browse.jhtml","content":"Artists A-Z"}},{"a":[{"href":"/music/artists/browse.jhtml?chars=a","content":"A"},{"href":"/music/artists/browse.jhtml?chars=b","content":"B"},{"href":"/music/artists/browse.jhtml?chars=c","content":"C"},{"href":"/music/artists/browse.jhtml?chars=d","content":"D"},{"href":"/music/artists/browse.jhtml?chars=e","content":"E"},{"href":"/music/artists/browse.jhtml?chars=f","content":"F"},{"href":"/music/artists/browse.jhtml?chars=g","content":"G"},{"href":"/music/artists/browse.jhtml?chars=h","content":"H"},{"href":"/music/artists/browse.jhtml?chars=i","content":"I"},{"href":"/music/artists/browse.jhtml?chars=j","content":"J"},{"href":"/music/artists/browse.jhtml?chars=k","content":"K"},{"href":"/music/artists/browse.jhtml?chars=l","content":"L"},{"href":"/music/artists/browse.jhtml?chars=m","content":"M"},{"href":"/music/artists/browse.jhtml?chars=n","content":"N"},{"href":"/music/artists/browse.jhtml?chars=o","content":"O"},{"href":"/music/artists/browse.jhtml?chars=p","content":"P"},{"href":"/music/artists/browse.jhtml?chars=q","content":"Q"},{"href":"/music/artists/browse.jhtml?chars=r","content":"R"},{"href":"/music/artists/browse.jhtml?chars=s","content":"S"},{"href":"/music/artists/browse.jhtml?chars=t","content":"T"},{"href":"/music/artists/browse.jhtml?chars=u","content":"U"},{"href":"/music/artists/browse.jhtml?chars=v","content":"V"},{"href":"/music/artists/browse.jhtml?chars=w","content":"W"},{"href":"/music/artists/browse.jhtml?chars=x","content":"X"},{"href":"/music/artists/browse.jhtml?chars=y","content":"Y"},{"href":"/music/artists/browse.jhtml?chars=z","content":"Z"},{"href":"/music/artists/browse.jhtml?chars=.","content":"#"}],"class":"gridMainBrowseAll"}]},{"class":"centerCol","li":[{"class":"first","span":"Music Videos"},{"a":{"href":"/music/video/","content":"Our Picks"}},{"a":{"href":"/music/video/premieres.jhtml","content":"Video Premieres"}},{"a":{"href":"/overdrive/?id=1568964","content":"MTV2 Video Premieres"}},{"a":{"href":"/music/video/popular.jhtml","content":"Most Popular Videos"}},{"a":{"href":"/music/playlists/","content":"Playlists"}},{"a":{"href":"/music/playlibs/","content":"Artist Hosted: Playlibs"}},{"a":{"href":"/music/live_performances/","content":"Live Performances"}},{"a":{"href":"/music/yearbook/","content":"Top Music Videos By Year"}}]},{"class":"centerCol","li":[{"class":"first","span":"artists"},{"a":{"href":"/music/artists/browse.jhtml?chars=a","content":"Browse A-Z"}},{"a":{"href":"/music/artists/","content":"Our Picks"}},{"a":{"href":"/music/artists/most_popular.jhtml","content":"Most Popular"}},{"a":{"href":"/music/discover_download/","content":"New Artists: Discover & Download"}},{"a":{"href":"/music/photos/","content":"Artist Photos"}}]},{"class":"centerCol","li":[{"class":"first","span":"Specials"},{"a":{"href":"/specials/halloween/","content":"Halloween On MTV"}},{"a":{"href":"/ontv/vma/2009/","content":"2009 Video Music Awards"}},{"a":{"href":"/specials/michaeljackson/","content":"Michael Jackson Remembered"}},{"a":{"href":"/music/unplugged/","content":"MTV Unplugged"}},{"a":{"href":"/specials/hottest/mc/","content":"Hottest MCs In The Game"}},{"a":{"href":"http://www.mtv.com/ontv/woodieawards/2009/","target":"_blank","content":"mtvU Woodie Awards"}},{"a":{"href":"/music/the_leak/","content":"Full Album Previews: The Leak"}},{"a":{"href":"http://www.mtv.com/fivedollarcover/","target":"_blank","content":"$5 Cover"}}]},{"ul":[{"class":"rightBlock split","li":[{"class":"first","span":"pop"},{"a":{"href":"/music/pop/","content":"Pop Main"}},{"a":{"href":"http://blog.rhapsody.com/?textnavblog","target":"_blank","content":"Rhapsody Blog"}}]},{"class":"rightBlock ","li":[{"class":"first","span":"Rock"},{"a":{"href":"/music/rock/","content":"Rock Main"}},{"a":{"href":"/shows/you_rock_the_deuce/series.jhtml","content":"Rock The Deuce"}},{"a":{"href":"/shows/headbangers_ball/series.jhtml","content":"Headbangers Ball"}}]}],"class":"centerCol"},{"ul":[{"class":"rightBlock split","li":[{"class":"first","span":"Hip-Hop"},{"a":{"href":"/music/hiphop/","content":"Hip-Hop Main"}},{"a":{"href":"/shows/sucker_free/series.jhtml","content":"Sucker Free"}},{"a":{"href":"/news/topic/mixtape_daily/","content":"Mixtape Daily"}}]},{"class":"rightBlock ","li":[{"class":"first","span":"indie"},{"a":{"href":"/music/indie/","content":"Indie Main"}},{"a":{"href":"/shows/subterranean/series.jhtml","content":"Subterranean"}}]}],"class":"centerCol last"}],"class":"grid","id":"music-grid"}}},"class":"toplvl","id":"n-music"},{"class":"seperator","content":"|"},{"a":{"href":"http://www.mtv.com/ontv/","class":"n-link shows","content":"Shows","id":"shows"},"ul":{"class":"gridContainer","li":{"div":{"ul":[{"class":"gridMain","li":[{"a":{"href":"/ontv/","content":"Shows Main"}},{"a":{"href":"/ontv/all/","content":"All Shows"}},{"a":{"href":"/ontv/schedule/","content":"TV Schedule"}},{"a":{"href":"http://remotecontrol.mtv.com","target":"_blank","content":"MTV Shows Gossip Blog"}},{"a":{"href":"http://soundtrack.mtv.com","target":"_blank","content":"Music in Shows"}},{"a":{"href":"/ontv/photos/","content":"Show Photos"}},{"a":{"href":"/ontv/castingcall/","content":"Be on MTV"}},{"a":{"href":"http://shop.mtv.com/?v=mtv_shows","target":"_blank","content":"Shop MTV Shows"}}]},{"ul":[{"li":[{"a":{"href":"/shows/16_and_pregnant/season_1/series.jhtml","content":"16 and Pregnant"}},{"a":{"href":"/ontv/dyn/dance_crew/series.jhtml","content":"America's Best Dance Crew"}},{"a":{"href":"/ontv/dyn/behind_the_screen/series.jhtml","content":"Behind The Screen"}},{"a":{"href":"/shows/the-city/series.jhtml","content":"The City"}},{"a":{"href":"/ontv/dyn/cribs/series.jhtml","content":"Cribs"}},{"a":{"href":"/shows/degrassi/series.jhtml","content":"Degrassi: The Next Generation"}},{"a":{"href":"/shows/disaster_date/series.jhtml","content":"Disaster Date"}},{"a":{"href":"http://www.mtv.com/fivedollarcover/","target":"_blank","content":"$5 Cover"}},{"a":{"href":"/shows/gone_too_far/series.jhtml","content":"Gone Too Far"}},{"a":{"href":"/shows/the_hills/series.jhtml","content":"The Hills"}}]},{"li":[{"a":{"href":"/shows/alexa_chung/series.jhtml","content":"It's On with Alexa Chung"}},{"a":{"href":"/shows/jersey_shore/series.jhtml","content":"Jersey Shore"}},{"a":{"href":"/shows/made/series.jhtml","content":"MADE"}},{"a":{"href":"/ontv/shorts/","content":"MTV Shorts"}},{"a":{"href":"/music/unplugged/","content":"MTV Unplugged"}},{"a":{"href":"/shows/sweet_16/series.jhtml","content":"My Super Sweet 16"}},{"a":{"href":"/ontv/dyn/nitro_circus/series.jhtml","content":"Nitro Circus"}},{"a":{"href":"http://northpalmwrestling.mtv.com/","target":"_blank","content":"North Palm Wrestling"}},{"a":{"href":"/shows/parental_control/series.jhtml","content":"Parental Control"}},{"a":{"href":"/ontv/dyn/rw_cancun/series.jhtml","content":"Real World: Cancun"}},{"a":{"href":"/shows/rwrr_challenge_theruins/series.jhtml","content":"RW/RR Challenge: The Ruins"}}]},{"li":[{"a":{"href":"/ontv/dyn/fantasy_factory/series.jhtml","content":"Rob Dyrdek's Fantasy Factory"}},{"a":{"href":"/ontv/dyn/runs_house/series.jhtml","content":"Run's House"}},{"a":{"href":"/ontv/dyn/silent_library/series.jhtml","content":"Silent Library"}},{"a":{"href":"/shows/styld/series.jhtml","content":"Styl'D"}},{"a":{"href":"/ontv/dyn/teen_cribs/series.jhtml","content":"Teen Cribs"}},{"a":{"href":"/shows/teen_mom/series.jhtml","content":"Teen Mom"}},{"a":{"href":"/shows/truelife/series.jhtml","content":"True Life"}},{"a":{"href":"/shows/valemont/series.jhtml","content":"Valemont"}},{"a":{"href":"/shows/worlds_strictest_parents/series.jhtml","content":"World's Strictest Parents"}},{"a":{"href":"/ontv/all/","class":"allshows","content":"All Shows"},"class":"allshowsLabel"}]}],"class":"centerCol wide","li":{"class":"first","span":"Popular Shows"}},{"class":"centerCol","li":[{"class":"first","span":"specials"},{"a":{"href":"/ontv/vma/2009/","content":"2009 Video Music Awards"}},{"a":{"href":"/ontv/movieawards/2009/","content":"2009 Movie Awards"}},{"a":{"href":"/ontv/woodieawards/2009/","content":"mtvU Woodie Awards"}},{"a":{"href":"/movies/movie/436051/moviemain.jhtml","content":"My Super Psycho Sweet 16"}},{"a":{"href":"/shows/return_to_duty/series.jhtml","content":"Real World Presents: Return To Duty"}},{"a":{"href":"/specials/what_were_u_thinking/","content":"What Were U Thinking?"}},{"a":{"href":"/shows/spring_break_10/series.jhtml","content":"Spring Break 2010"}}]},{"class":"centerCol last","li":[{"class":"first","span":"classics"},{"a":{"href":"/shows/aeon_flux/series.jhtml","content":"Aeon Flux"}},{"a":{"href":"/shows/beavis_and_butthead/series.jhtml","content":"Beavis & Butt-Head"}},{"a":{"href":"/ontv/dyn/celebrity_deathmatch/series.jhtml","content":"Celebrity Deathmatch"}},{"a":{"href":"/ontv/dyn/jackass/series.jhtml","content":"Jackass World"}},{"a":{"href":"/shows/laguna_beach/season_1/series.jhtml","content":"Laguna Beach"}},{"a":{"href":"/ontv/liquid_television/","content":"Liquid Television"}},{"a":{"href":"/ontv/dyn/the_maxx/series.jhtml","content":"The Maxx"}},{"a":{"href":"/ontv/dyn/pimp_my_ride/series.jhtml","content":"Pimp My Ride"}},{"a":{"href":"/shows/punkd/series.jhtml","content":"Punk'd"}},{"a":{"href":"/shows/the_state/series.jhtml","content":"THE STATE"}},{"a":{"href":"/ontv/dyn/trl/series.jhtml","content":"TRL"}},{"a":{"href":"/music/yo_mtv_raps/","content":"Yo! MTV Raps"}}]}],"class":"grid","id":"shows-grid"}}},"class":"toplvl","id":"n-shows"},{"class":"seperator","content":"|"},{"a":{"href":"http://www.mtv.com/news/","class":"n-link news","content":"News","id":"news"},"ul":{"class":"gridContainer","li":{"div":{"ul":[{"class":"gridMain","li":[{"a":{"href":"/news/","content":"News Main"}},{"a":{"href":"/news/topic/mixtape_daily/","content":"Mixtape Daily"}},{"a":{"href":"http://twitter.com/mtvnews","target":"_blank","content":"MTV News On Twitter"}},{"a":{"href":"http://your.mtv.com/","target":"_blank","content":"Your Uploads"}}]},{"class":"centerCol","li":[{"class":"first","span":"news categories"},{"a":{"href":"/news/#breaking","content":"Breaking News"},"id":"newsMain1Tab"},{"a":{"href":"/news/#music","content":"Music News"},"id":"newsMain2Tab"},{"a":{"href":"/news/#movie","content":"Movie News"},"id":"newsMain3Tab"},{"a":{"href":"/news/#celebrity","content":"Celebrity News"},"id":"newsMain4Tab"}]},{"class":"centerCol","li":[{"class":"first","span":"newsroom blog"},{"a":{"href":"http://newsroom.mtv.com/","content":"Latest Posts"}},{"a":{"href":"http://newsroom.mtv.com/category/top_categories/wake-up-video/","content":"Wake Up-Video"}},{"a":{"href":"http://newsroom.mtv.com/category/oh-snap-poll/","content":"Daily Poll"}},{"a":{"href":"http://newsroom.mtv.com/category/top_categories/behind-the-scenes/","content":"Behind The Scenes"}}]},{"class":"centerCol","li":[{"class":"first","span":"Video Game News"},{"a":{"href":"http://multiplayerblog.mtv.com/","content":"Latest Posts"}},{"a":{"href":"http://multiplayerblog.mtv.com/category/navigation_menu/xbox-360/","content":"Xbox 360 News"}},{"a":{"href":"http://multiplayerblog.mtv.com/category/navigation_menu/wii/","content":"Wii News"}},{"a":{"href":"http://multiplayerblog.mtv.com/category/navigation_menu/ps3/","content":"PS3 News"}}]},{"class":"centerCol last","li":[{"class":"first","span":"mtv reporters"},{"a":{"href":"http://newsroom.mtv.com/author/jimc/","content":"Jim Cantiello"}},{"a":{"href":"/news/correspondents/kash/","content":"Tim Kash"}},{"a":{"href":"/news/correspondents/loder/","content":"Kurt Loder"}},{"a":{"href":"/news/correspondents/sway/","content":"Sway"}}]}],"class":"grid","id":"news-grid"}}},"class":"toplvl","id":"n-news"},{"class":"seperator","content":"|"},{"a":{"href":"http://www.mtv.com/movies/","class":"n-link last movies","content":"Movies","id":"movies"},"ul":{"class":"gridContainer","li":{"div":{"ul":[{"class":"gridMain","li":[{"a":{"href":"/movies/","content":"Movies Main"}},{"a":{"href":"http://shop.mtv.com/?v=mtv_dvds","target":"_blank","content":"MTV Movies Shop"}},{"a":{"href":"/movies/photo/","content":"Red Carpet & On Set Photos"}}]},{"class":"centerCol","li":[{"class":"first","span":"trailers & reviews"},{"a":{"href":"/movies/trailer_park/","content":"Trailers"}},{"a":{"href":"/movies/news/loder/","content":"Kurt Loder Film Reviews"}}]},{"class":"centerCol","li":[{"class":"first","span":"news & blogs"},{"a":{"href":"/news/#movie","content":"Movies News"},"id":"newsMain3Tab"},{"a":{"href":"http://moviesblog.mtv.com","content":"Movies Blog"}},{"a":{"href":"http://splashpage.mtv.com","content":"Comic Book Movies Blog"}},{"a":{"href":"http://hollywoodcrush.mtv.com/","content":"Young Hollywood Blog"}},{"a":{"href":"/movies/features_interviews/morevideo.jhtml","content":"Video News & Interviews"}}]},{"class":"centerCol last","li":[{"class":"first","span":"specials"},{"a":{"href":"/specials/halloween/","content":"Halloween On MTV"}}]}],"class":"grid","id":"movies-grid"}}},"class":"toplvl","id":"n-movies"}],"id":"navlist"}],"class":"globalNav","id":"nav"}};

this.fnHeaderObj = {"div":{"div":{"div":{"code":{"class":"hide"},"class":"fluxWidget","id":"wQuickMenu"},"id":"memberbar"},"ul":{"class":"franchise-nav","li":[{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/","class":"n-link ","content":"Home"},"class":"toplvl","id":"n-"},{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/music-videos.jhtml","class":"n-link ","content":"Music Videos"},"class":"toplvl","id":"n-"},{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/uploads.jhtml","class":"n-link ","content":"Fan Uploads"},"class":"toplvl","id":"n-"},{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/playlists.jhtml","class":"n-link ","content":"Classic Videos"},"class":"toplvl","id":"n-"},{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/photos.jhtml","class":"n-link ","content":"Photos"},"class":"toplvl","id":"n-"},{"a":{"href":"http://community.mtv.com/Content/Discussions/DiscussionBoard.aspx?catId=19368","target":"_blank","class":"n-link ","content":"Message Boards"},"class":"toplvl","id":"n-"},{"a":{"href":"http://www.mtv.com/ontv/fn-mtv/about.jhtml","class":"n-link last about","content":"About","id":"about"},"class":"toplvl","id":"n-about"}],"id":"navlist"},"class":"franchise franchise-navigation","id":"nav"}};

this.create = function(name, contextNodeID){
switch(name){
case 'css': this.addCSS(); break;
case 'hat': this.setHat(); break;
case 'nav': Community.Widgets.createNav(contextNodeID); break;
case 'artistlist': Community.Widgets.createArtistlist(contextNodeID); break;
case 'footer': Community.Widgets.createFooter(contextNodeID); break;
case 'search': Community.Widgets.createSearch(contextNodeID); break;
default: break;
}
}

this.createSearch = function(contextNodeID){
var div = document.createElement('div');
div.innerHTML = '<' + 'iframe src="' + Community.Widgets.hostname + '/widgets/search/iframe.jhtml" width="321" height="33" frameborder="0" scrolling="no" style="float:right;">search mtv</iframe>';
var contextNode = document.getElementById(contextNodeID);
if (contextNode) contextNode.appendChild(div);
}

this.createNav = function(contextNodeId, headerObj){
var obj = (headerObj!=null) ? headerObj : Community.Widgets.headerObj;

if( obj ){

if(obj.div['class'] == 'franchise franchise-navigation') {
var container = document.getElementById(contextNodeId);
container.appendChild(Community.Widgets.createUL(obj.div.ul)); // Append NavList
} else if ( obj.div['class'] == 'globalNav' ) {
var container = document.getElementById(contextNodeId);

// Add class / id data to nav container
container.setAttribute('id', obj.div.id);
container.className = obj.div['class'];

memberbarDiv = document.getElementById('memberbar');
memberbarPlaceholder = document.getElementById('memberbar_insert_placeholder');
try {	
memberbarLinks = Community.Widgets.createDiv(obj.div.div[0].div[0]);
memberbarDiv.insertBefore(memberbarLinks, memberbarPlaceholder); // Append memberbar Links to memberbar

aList = memberbarDiv.getElementsByTagName("a");

memberbarLinks.insertBefore(Community.Widgets.createUL(obj.div.div[0].ul), aList[1]);

}
catch(e){}

container.appendChild(Community.Widgets.createDiv(obj.div.div[1]), false); // Append MTV Logo
container.appendChild(Community.Widgets.createUL(obj.div.ul[0])); // Append TopNavLinks
container.appendChild(Community.Widgets.createUL(obj.div.ul[1])); // Append NavList
container.appendChild(Community.Widgets.createDiv(obj.div.div[2]), false); // Append LogoToolTip
container.appendChild(Community.Widgets.createDiv(obj.div.div[3]), false); // Append search
}

}
}

this.createFooter = function(contextNodeId){
var obj = {"div":{"div":[{"class":"mfbar1"},{"div":{"div":[{"div":[{"img":{"width":"136","height":"24","src":"http://www.mtv.com/widgets/assets/mtvn.gif","border":"0","alt":"MTV Networks"},"id":"mflogo"},{"content":"&copy; 2009 MTV Networks, &copy; and TM MTV Networks. All Rights Reserved.","id":"mfcopy"}],"id":"mftnetworks"},{"div":[{"a":[{"href":"http://www.mtv.com","class":"mftlinkitem","content":"MTV"},{"href":"http://www.mtv2.com","class":"mftlinkitem","content":"MTV2"},{"href":"http://www.mtvtr3s.com/","class":"mftlinkitem","content":"MTV Tr3s"},{"href":"http://www.mtvu.com","class":"mftlinkitem","content":"MTVU"},{"href":"http://www.mtviggy.com/","class":"mftlinkitem","content":"MTV Iggy"},{"href":"http://adready.com/campaign_event/click/1012391?h=c7de74e9550a287224ec&footer","img":{"src":"http://www.mtv.com/widgets/assets/rhapsody.gif","border":"0","alt":"Rhapsody"},"class":"mftlinkitem"},{"href":"http://shop.mtv.com/","class":"mftlinkitem","content":"MTV Shop"},{"href":"http://think.mtv.com/","class":"mftlinkitem","content":"Think"},{"href":"http://www.seenonmtv.com/","class":"mftlinkitem","content":"Seen On MTV"},{"href":"http://www.mtv.com/directory/","class":"mftlinkitem","content":"Directory of MTV sites"},{"href":"http://www.mtv.com/partners/mtv_tribe/index.jhtml","class":"mftlinkitem","content":"Partners"}],"class":"mftlinkbox","content":["|","|","|","|","|","|","|","|","|","|"]},{"a":[{"href":"http://community.mtv.com/Content/Discussions/DiscussionBoard.aspx?catId=22916","class":"mftlinkitem","content":"Site Feedback"},{"href":"http://community.mtv.com/Content/Discussions/DiscussionBoard.aspx?catId=22922","class":"mftlinkitem","content":"Suggestion Box"},{"href":"http://community.mtv.com/Content/Discussions/DiscussionBoard.aspx?catId=22921","class":"mftlinkitem","content":"Community Feedback"},{"href":"http://www.mtv.com/ontv/castingcall/","class":"mftlinkitem","content":"MTV Casting"},{"href":"http://www.mtv.com/sweepstakes/","class":"mftlinkitem","content":"Sweepstakes & Contests"},{"href":"http://exodus.mtv.com/site/signup","class":"mftlinkitem","content":"Newsletters"},{"href":"http://www.mtv.com/rss/","class":"mftlinkitem","content":"Podcasts"},{"href":"http://www.mtv.com/rss/","class":"mftlinkitem","content":"RSS"},{"href":"http://community.mtv.com/Content/Discussions/DiscussionBoard.aspx?catId=22920","class":"mftlinkitem","content":"Technical Support"},{"href":"http://flux.com","class":"mftlinkitem","content":"MTV is in Flux"}],"class":"mftlinkbox","content":["|","|","|","|","|","|","|","|","|"]},{"a":[{"href":"http://www.mtv.com/music/artists/browse.jhtml?chars=a","class":"mftlinkitem","content":"Browse All Artists"},{"href":"http://www.mtv.com/music/video/index.jhtml ","class":"mftlinkitem","content":"Music Videos"},{"href":"http://www.mtv.com/ontv/","class":"mftlinkitem","content":"MTV Reality Shows"},{"href":"http://www.mtv.com/news/","class":"mftlinkitem","content":"Celebrity News"},{"href":"http://www.mtv.com/movies/trailer_park/","class":"mftlinkitem","content":"Movie Trailers"},{"href":"http://www.mtv.com/music/downloads/","class":"mftlinkitem","content":"Free Music Downloads"},{"href":"http://www.mtv.com/mtvradio/","class":"mftlinkitem","content":"Free Online Radio"},{"href":"http://www.mtv.com/lyrics/","class":"mftlinkitem","content":"Song Lyrics"},{"href":"http://www.mtv.com/mobile/ringtones/","class":"mftlinkitem","content":"Ringtones"},{"href":"http://think.mtv.com/Issues/politics/","class":"mftlinkitem","content":"Activism"}],"class":"mftlinkbox","content":["|","|","|","|","|","|","|","|","|"]}],"id":"mftlinks"}],"id":"mftop"},"id":"mfrow1"},{"div":{"a":[{"href":"http://labsblog.mtv.com/","content":"MTV Labs"},{"href":"https://jobhuntweb.viacom.com/jobhunt/main/jobhome.asp","content":"MTV Jobs"},{"href":"http://adspecs.mtvn.com/site/mtv/mtv.html","content":"Advertising Opportunities"},{"href":"http://www.mtv.com/sitewide/legal/terms.jhtml","content":"Terms of Use"},{"href":"http://www.mtv.com/sitewide/legal/privacy.jhtml","span":{"content":"Privacy Policy/Your CA Privacy Rights (Updated 10/19/09)","style":"color:#8c8c8c;"}},{"href":"http://www.mtv.com/sitewide/legal/copyright_compliance.jhtml","content":"Copyright Compliance Policy"},{"href":"http://www.mtv.com/sitewide/legal/community_guidelines.jhtml","content":"Community Guidelines"},{"href":"http://www.mtv.com/sitewide/legal/user_content.jhtml","content":"User Content Submission Agreement"},{"href":"http://www.socialproject.com/PrivacyPolicy.html","content":"Social Project Privacy Policy"},{"href":"http://www.socialproject.com/TermsOfUse.html","content":"Social Project Terms of Use"}],"content":["|","|","|","|","|","|","|","|","|"],"id":"mfbottom"},"id":"mfrow2"},{"a":[{"href":"http://www.mtv.com/music/artist/spears_britney/artist.jhtml","content":"Britney Spears"},{"href":"http://www.mtv.com/music/artist/lil_wayne/artist.jhtml","content":"Lil Wayne"},{"href":"http://www.mtv.com/music/artist/50_cent/artist.jhtml","content":"50 Cent"},{"href":"http://www.mtv.com/music/artist/jonas_brothers/artist.jhtml","content":"Jonas Brothers"},{"href":"http://www.mtv.com/music/artist/rihanna/artist.jhtml","content":"Rihanna"},{"href":"http://www.mtv.com/music/artist/timberlake_justin/artist.jhtml","content":"Justin Timberlake"},{"href":"http://www.mtv.com/music/artist/aguilera_christina/artist.jhtml","content":"Christina Aguilera"},{"href":"http://www.mtv.com/music/artist/knowles_beyonce/artist.jhtml","content":"Beyonce"}],"content":["|","|","|","|","|","|","|"],"span":"Popular Links","id":"mfpoplinks"}],"id":"mtv_foot"}};

if (obj.div){
var container = document.getElementById(contextNodeId);

var div = document.createElement('div');
if(obj.div.id) div.setAttribute('id', obj.div.id);

for (var x=0; x<obj.div.div.length; x++){
div.appendChild(Community.Widgets.createDiv(obj.div.div[x], true));
}
container.appendChild(div);
}
}

this.createArtistlist = function(contextNodeId){
var obj = Community.Widgets.headerObj.div.div[0].ul;
if(obj){
var container = document.getElementById(contextNodeId); 
var ul = Community.Widgets.createUL(obj);
container.appendChild(ul);
}
}

this.createP = function(p, useSeparator){
var pElement = document.createElement('p');
if(p.id) pElement.setAttribute('id', p.id);
if(p['class']) pElement.className = p['class'];

if (p.a){
for (var x=0; x<p.a.length; x++){
pElement.appendChild(Community.Widgets.createA(p.a[x]));
if (x<p.a.length-1 && useSeparator) pElement.appendChild(document.createTextNode("|"));
}
}
else{ pElement.innerHTML = p.content; }
return pElement;
}

this.createScript = function(scriptcontent) {

var scriptElement = document.createElement('script');

if(scriptcontent.src) {
scriptElement.setAttribute('src', scriptcontent.src);
} else {
scriptElement.innerHTML = scriptcontent;
}
return scriptElement;
}

this.createImg = function(img){
var imgElement = document.createElement('img');
if(img.id) imgElement.setAttribute('id', p.id);

if(img['class']) imgElement.className = img['class'];
if(img.height) imgElement.setAttribute('height', img.height);
if(img.width) imgElement.setAttribute('width', img.width);
if(img.src) imgElement.setAttribute('src', img.src);
if(img.border) imgElement.setAttribute('border', img.border);
if(img.alt) imgElement.setAttribute('height', img.alt);

return imgElement;
}

this.createUL = function(ul){

var ulElement = document.createElement('ul');

if(ul.id) ulElement.setAttribute('id', ul.id);

if(ul['class']) ulElement.className = ul['class'];

if(ul.li) {
if(ul.li instanceof Array) {
for (var x=0; x<ul.li.length; x++){
ulElement.appendChild(Community.Widgets.createLI(ul.li[x]));
}
} else {
ulElement.appendChild(Community.Widgets.createLI(ul.li));
}
}
if(ul.ul) {
if(ul.ul instanceof Array) {
for(var x=0; x<ul.ul.length; x++) {
ulElement.appendChild(Community.Widgets.createUL(ul.ul[x]));
}
} else {
ulElement.appendChild(Community.Widgets.createUL(ul.ul));
}
}
return ulElement;
}

this.createLI = function(li){

var liElement = document.createElement('li');

if(li.content) liElement.innerHTML = li.content;

if(li.id) liElement.setAttribute('id', li.id);
if(li['class']) liElement.className = li['class'];

if(li.a) {
if(li.a instanceof Array) {
for( var i=0; i<li.a.length; i++ ) {
liElement.appendChild(Community.Widgets.createA(li.a[i]));
}
} else {
liElement.appendChild(Community.Widgets.createA(li.a));
}
}

if(li.span){
if(li.span instanceof Array){ 
for (var i=0; i<li.span.length; i++){
liElement.appendChild(Community.Widgets.createSpan(li.span[i]));
}
}
else liElement.appendChild(Community.Widgets.createSpan(li.span));
} 

if (li.ul) liElement.appendChild(Community.Widgets.createUL(li.ul));

if (li.div) liElement.appendChild(Community.Widgets.createDiv(li.div));

/*
if (window.attachEvent){
liElement.onmouseover=function() {	this.className+=" sfhover";	}
liElement.onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); }
}
*/
return liElement;
}

this.createDiv = function(div, useSeparator){

var divElement = document.createElement('div');

if(div.id) divElement.setAttribute('id', div.id);
if(div['class']) divElement.className = div['class'];

if(div.div instanceof Array){
for (var i=0; i<div.div.length; i++){
divElement.appendChild(Community.Widgets.createSubDiv(div.div[i], useSeparator));
}

}	
else if(div.div instanceof Object && div.div.div instanceof Array){
for (var i=0; i<div.div.div.length; i++){
divElement.appendChild(Community.Widgets.createSubDiv(div.div.div[i], useSeparator));
}
}
else if(div.div instanceof Object && div.div.a instanceof Array){
var divContainer = document.createElement('div');
if(div.div.id) divContainer.setAttribute('id', div.div.id);
if(div['class']) divContainer.className = div['class'];
divElement.appendChild(divContainer);

for (var i=0; i<div.div.a.length; i++){
divContainer.appendChild(Community.Widgets.createA(div.div.a[i]));
if (i<div.div.a.length-1 && useSeparator) divContainer.appendChild(document.createTextNode(" | ")); 
}
}

if( div.ul ) {
if( div.ul instanceof Array ) {
for( var i = 0; i< div.ul.length; i++ ) { 
divElement.appendChild(Community.Widgets.createUL(div.ul[i]));
}
} else {
divElement.appendChild(Community.Widgets.createUL(div.ul));
}
}

if(div.dl instanceof Array){
for (var i=0; i<div.dl.length; i++){
var dl = div.dl[i];
var dlElement = document.createElement('dl');
if(dl.id) dlElement.setAttribute('id', dl.id);
if(dl.dt){
var dtElement = document.createElement('dt');
dtElement.innerHTML = dl.dt;
dlElement.appendChild(dtElement);
}

if(dl.dd instanceof Array){
for (var j=0; j<dl.dd.length; j++){
var ddElement = document.createElement('dd');
ddElement.appendChild(Community.Widgets.createA(dl.dd[j].a));
dlElement.appendChild(ddElement);
}
}

divElement.appendChild(dlElement);
}
} 

if(div.span){
if(div.span instanceof Array){
for (var i=0; i<div.span.length; i++){
divElement.appendChild(Community.Widgets.createSpan(div.span[i]));
}
}
else divElement.appendChild(Community.Widgets.createSpan(div.span));
}

if(div.a){
if(div.a instanceof Array){
for (var i=0; i<div.a.length; i++){
divElement.appendChild(Community.Widgets.createA(div.a[i]));
if (i<div.a.length-1 && useSeparator) divElement.appendChild(document.createTextNode(" | "));
}
}
else divElement.appendChild(Community.Widgets.createA(div.a));
}

if(div.p){
if(div.p instanceof Array){
for (var i=0; i<div.p.length; i++){
divElement.appendChild(Community.Widgets.createP(div.p[i], useSeparator));
}
}
else divElement.appendChild(Community.Widgets.createP(div.p, useSeparator));
}

if(div.img){
if(div.img instanceof Array){
for (var i=0;i<div.img.length;i++){
divElement.appendChild(Community.Widgets.createImg(div.img[i]));
}
}
else divElement.appendChild(Community.Widgets.createImg(div.img));
}

if(div.form)
divElement.appendChild(Community.Widgets.createForm(div.form));

if(div.content && !(div.content instanceof Array)){
divElement.innerHTML = div.content;
}

return divElement;
}

this.createSubDiv = function(subDiv, useSeparator){

var subDivElement = document.createElement('div');
if(subDiv.id) subDivElement.setAttribute('id', subDiv.id);
if(subDiv['class']) subDivElement.className = subDiv['class'];
if(subDiv.strong) subDivElement.appendChild(Community.Widgets.createStrong(subDiv.strong));

if(subDiv.span){
if(subDiv.span instanceof Array){
for (var i=0; i<subDiv.span.length; i++){
subDivElement.appendChild(Community.Widgets.createSpan(subDiv.span[i]));
}
}
else subDivElement.appendChild(Community.Widgets.createSpan(subDiv.span));
}

if(subDiv.a instanceof Array){
for (var i=0; i<subDiv.a.length; i++){
subDivElement.appendChild(Community.Widgets.createA(subDiv.a[i]));
if (i<subDiv.a.length-1 && useSeparator) subDivElement.appendChild(document.createTextNode(" | "));
}
}

if(subDiv.div instanceof Array){
for (var i=0; i<subDiv.div.length; i++){
subDivElement.appendChild(Community.Widgets.createSubDiv(subDiv.div[i], useSeparator));
}
}
else if(subDiv.div instanceof Object && subDiv.div.a instanceof Array){
for (var i=0; i<subDiv.div.a.length; i++){
subDivElement.appendChild(Community.Widgets.createA(subDiv.div.a[i]));
if (i<subDiv.div.a.length-1 && useSeparator) subDivElement.appendChild(document.createTextNode(" | ")); 
}
}

if(subDiv.div) subDivElement.appendChild(Community.Widgets.createDiv(subDiv.div, useSeparator));

if(subDiv.p){
if(subDiv.p instanceof Array){
for (var i=0; i<div.p.length; i++){
subDivElement.appendChild(Community.Widgets.createP(subDiv.p[i], useSeparator));
}
}
else subDivElement.appendChild(Community.Widgets.createP(subDiv.p, useSeparator));
}

if(subDiv.img){
if(subDiv.img instanceof Array){
for (var i=0;i<div.img.length;i++){
subDivElement.appendChild(Community.Widgets.createImg(subDiv.img[i]));
}
}
else subDivElement.appendChild(Community.Widgets.createImg(subDiv.img));
} 

if(subDiv.content && !(subDiv.content instanceof Array)){
subDivElement.innerHTML = subDiv.content;
}

return subDivElement;
}

this.createA = function(a){
var aElement = document.createElement('a');

if(a.id) aElement.setAttribute('id', a.id);
if(a['class']) aElement.className = a['class'];
if(a.href) {
if(a.href.substr(0,1) == '/') {
aElement.setAttribute('href', Community.Widgets.baseUrl + a.href);
} else {
aElement.setAttribute('href', a.href);
}
}
if(a.target) aElement.setAttribute('target', a.target);
if(a.onclick) aElement.setAttribute('onclick', a.onclick);
if(a.img){
aElement.appendChild(Community.Widgets.createImg(a.img));
}
else {
aElement.innerHTML = a.content;
}	

return aElement;
}

this.createSpan = function(span){
var spanElement = document.createElement('span');

if(typeof span == 'object'){
if(span['class']) spanElement.className = span['class'];
if(span.content) spanElement.innerHTML = span.content;
if(span.a instanceof Array){
for(var i=0; i<span.a.length; i++){
spanElement.appendChild(Community.Widgets.createA(span.a[i]));
spanElement.innerHTML += "\n";
spanElement.appendChild(document.createTextNode(""));
}
}
}
else { spanElement.innerHTML = span + "\n";}

return spanElement;
}

this.createStrong = function(strong){
var strongElement = document.createElement('strong');
strongElement.innerHTML = strong;
return strongElement;
}

this.createForm = function(form) {
var formElement = document.createElement('form');
if(form.action) formElement.setAttribute('action', form.action);
if(form.method) formElement.setAttribute('method', form.method);
if(form.name) formElement.setAttribute('name', form.name);
if(form.id) formElement.setAttribute('id', form.id);
if(form.onsubmit) formElement.setAttribute('onsubmit', form.onsubmit);

formElement.appendChild(Community.Widgets.createInput(form.input));
formElement.appendChild(Community.Widgets.createButton(form.button[0]));
formElement.appendChild(Community.Widgets.createButton(form.button[1]));
return formElement;
}

this.createButton = function(button) {
var buttonElement = document.createElement('button');
if(button.id) buttonElement.setAttribute('id', button.id);
if(button.onclick) buttonElement.setAttribute('onclick', button.onclick);
buttonElement.innerHTML = button.content;
return buttonElement;
}

this.createInput = function(input) {
var inputElement = document.createElement('input');
if(input.id) inputElement.setAttribute('id', input.id);
if(input.name) inputElement.setAttribute('name', input.name);
if(input.onclick) inputElement.setAttribute('onclick', input.onclick);
if(input.onkeypress) inputElement.setAttribute('onkeypress', input.onkeypress);
if(input.type) inputElement.setAttribute('type', input.type);
if(input.value) inputElement.value = input.value;
return inputElement;
}
}

Community.Page.addCSSLink('/sitewide/css/u/screen.jhtml');
Community.Page.addCSSLink('/sitewide/community/css/common.css'); 

// discussion boards
if(
(Community.Page.path.indexOf('DiscussionResults.aspx') > 0 && (Community.Page.qs.indexOf('tcid') >= 0 || Community.Page.qs.indexOf('tcId') >= 0)) || Community.Page.path.indexOf('Topic') > 0){
Community.Page.createScript("/sitewide/community/json/discussion_categories.jhtml?callback=Community.Data.setDiscussionCategories");
}
else if(Community.Page.path.indexOf('Content/Video/VideoResults.aspx') > 0 && Community.Page.qs.indexOf('category') >= 0){
Community.Page.createScript("/sitewide/community/json/fn_video_categories.jhtml?callback=Community.Page.handleFnVideoCategory");
}
else{ Community.Page.setHat(); }
