// urls
var cinemanowSupportURL = 'http://www.cinemanow.com/RightNow.aspx';
var itunesSupportURL = 'http://support.apple.com/kb/HT1539';

// grab from cookie or default as en
var selectedLang = "";
var selectedCountry = null;
var selectedTitle = null;
var selectedMediaType = null;
var selectedOS = null;
var selectedSection = null;
var selectedSource = null;
var selectedRequestType = null;
var userID = null;
var selectedVendor = "DELUX";
var selectedVendorEmail = "";
var selectedTopSupportQue = "";
var selectedFAQCategory = "";
var selectedFormat ="";
var faqCounter = 0;
var showAuthCode = "";
var inApp = null;
var inAppAuthCode = null;
var authorizationCode="";
var error = null;
// used in sniffing user environment
var currentDomainEnv = "";
var wmpversion = "";
var securityversion = "";
var showWMVCategory;
var showITunesCategory;
var showdcManagerCategory;
var showdcMobileCategory;
var requiredInfoRedirect = null;
var ignoreLanguageCheck = true;
var isUsingComputerForDC = false;
var readyToLoad = false;
var dynamictitlemapData;
var strmy="discID";
var selectedForm ="";
var discInfo =null;
var paratureSchemaInfo = null;
var supportFormErrorCnt=0;
var useDTM = false;
// titles not to show in live
var noshowTitles;
var passthrough=true;

/**
*	Build the bottom shadow
*/
function buildShadowBottom() {
	return new Element('div', {id: 'shadow-bottom'}).insert( new Element('img', { width:'1', height:'1', border:'0'}) );
}

/**
*	Build Country selection
*/
function buildCountrySelector(obj) {
	log('buildCountrySelector: selectedLang = ' + selectedLang);
	
	if(obj != null && obj != undefined)
	{
		var countryList = new Element('ul');
		countryList.update(new Element('lh').addClassName('header').update(obj.countryNav.label));
		
		obj.countryNav.list.each(function(item) {
			var countryBtn = new Element('li').addClassName('button').update(item.label);
	
			Event.observe(countryBtn, 'click', function(event) {
				localizePage(item.id);
				// send info to omniture
//				var omniVars = new Object();
//				omniVars.pageName = "DVD Support Form Change Entry Page Language " + selectedLang;
//				omniVars.prop1 = "DVD Support." + selectedLang;
	//			doOmnitureTrackData(omniVars);
			});		
	
			countryList.insert(countryBtn);
		});	
	}
	$('country-list').update(countryList);
}

/**
*	Remove the country selection
*/
function clearCountrySelector() {
	//$('country-list').update();
}

/**
*	Build the updates panel
*/
function buildUpdatesForSpeedRacer() {
	var htmlText = '<div>'+Data.updatelabel[selectedLang].label+'</div>';
	htmlText += '<div class="title">SPEED RACER Blu-Ray';
	htmlText += '<div><a href="http://digitalcopy.warnerbros.com/support/speedracer_form.aspx">Digital Copy Support for iTunes&reg;</a></div></div>';
	
	$('updates-list').update(htmlText);
	
}

/**
*	Build the updates panel
*/
function buildUpdatesForFredClaus() {
	var htmlText = '<div>'+Data.updatelabel[selectedLang].label+'</div>';
	htmlText += '<div class="title">FRED CLAUS';
	htmlText += '<div><a href="http://www.wbdigitalcopy.co.uk/fredclaus/">Support for United Kingdom release</a></div></div>';

	$('updates-list').update(htmlText);
	
}

/**
*	Build the updates panel
*/
function buildUpdatesForDarkKnight() {
	var updatesList = new Element('ul');
	updatesList.update(new Element('lh').addClassName('header').update(Data.updatelabel[selectedLang].label));
	
	var updateBtn = new Element('li').addClassName('button').update(Data.authcodeerror[selectedLang].label);
	Event.observe(updateBtn, 'click', function(event) {
		selectedTopSupportQue="Code_Mismatch_DVD";
		buildSupport("Code_Mismatch_DVD");
	});	
	updatesList.insert(updateBtn);
	$('updates-list').update(updatesList);
	
}

/**
*	Build the updates panel
*/
function buildUpdatesForWonderWoman() {
	var updatesList = new Element('ul');
	updatesList.update(new Element('lh').addClassName('header').update(Data.updatelabel[selectedLang].label));
	
	var title = new Element('label').update(" <br\>Wonder Woman(DVD Special Edition)").setStyle({color:'#999999','font-family':'Arial,Helvetica,sans-serif','font-size':'12px'});
	var updateBtn = new Element('li').addClassName('button').update(Data.missingauthcode[selectedLang].label);
	Event.observe(updateBtn, 'click', function(event) {
		//selectedTopSupportQue="Missing_Auth_Code";
		//buildSupport("Missing_Auth_Code");
		showAuthCode = "false";
		buildSupportForm1();
	});	
	updatesList.insert(title);
	updatesList.insert(updateBtn);
	$('updates-list').update(updatesList);
	showAuthCode = "true";
}

/**
*	Build the updates panel
*/
function buildUpdatesForBenjaminButton() {
	var updatesList = new Element('ul');
	updatesList.update(new Element('lh').addClassName('header').update(Data.updatelabel[selectedLang].label));
	
	var title = new Element('lh').update(" <br\>Benjamin Button(Blu-Ray)").setStyle({color:'#999999','font-family':'Arial,Helvetica,sans-serif','font-size':'12px'});
	var updateBtn = new Element('li').addClassName('button').update(Data.authcodeerror[selectedLang].label);
	Event.observe(updateBtn, 'click', function(event) {
		selectedTopSupportQue="Code_Mismatch_DVD";
		buildSupport("Code_Mismatch_DVD");
	});	
	updatesList.insert(title).insert(updateBtn);
	$('updates-list').update(updatesList);
	showAuthCode = "true";
}

/**
*	Build the updates panel
*/
function buildUpdatesForBatman20Ann() {
	var updatesList = new Element('ul');
	updatesList.update(new Element('lh').update(Data.updatelabel[selectedLang].label));
	
	var title = new Element('lh').update(" <br\>Batman 20th Anniversary (Blu-Ray)").setStyle({color:'#999999','font-family':'Arial,Helvetica,sans-serif','font-size':'12px'});
	var updateBtn = new Element('li').addClassName('button').update(Data.authcodeerror[selectedLang].label);
	Event.observe(updateBtn, 'click', function(event) {
		selectedTopSupportQue="BatmanAnni_iTunes";
		selectedFormat = "itunes";
		buildSupport("BatmanAnni_iTunes");
	});	
	updatesList.insert(title).insert(updateBtn);
	$('updates-list').update(updatesList);
	showAuthCode = "true";
}

function clearUpdates() {
	if($('updates-list') != null )
		$('updates-list').update();
	if($('expire-info') != null )
		$('expire-info').update();
	
}

/**
*	Build Language selection
*/
function buildLanguageSelector1(obj) {
	log('buildLanguageSelector: selectedLang = ' + selectedLang);

	if(obj != null && obj != undefined)
	{
		var langList = new Element('ul');
		langList.update(new Element('lh').addClassName('header').update(obj.languageNav.label));
		
		obj.languageNav.list.each(function(item) {
			var langBtn = new Element('li').addClassName('button').update(item.label);
	
			Event.observe(langBtn, 'click', function(event) {
				localizePage(item.id);
			});		
	
			langList.insert(langBtn);
		});	
	}
/*	$('language-list').update(langList);*/ 
}

/**
 * builds the section title
 * @param {} obj
 */
function buildSectionTitle(obj)
{
/*	log('section-title: '+obj);
	if(obj == 'SUPPORT')
		$('section-title').update(obj);
	else
		$('section-title').update(obj.sectionlabel);*/
}

/**
*	Remove the language selection
*/
function clearLanguageSelector() {
	if($('language-list') != null)
		$('language-list').update('');
}

function buildLanguageSelector(obj){
	
	if(selectedSection == 'LandingPage')
		$('menu-div').style.display='none';
	else{
		
		var menuBtm = new Element('img',{src:'images/common/menu_btm.png',width:'251px',height:'28px'});
		var menuTop = new Element('img',{src:'images/common/menu_top.gif',width:'251px',height:'28px'});
		if(BrowserDetect.browser == "Explorer")
		{
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {
				//menuBtm = new Element('img',{src:'images/common/FOOTER.gif',width:'251px',height:'28px'});
			    fixPNG(menuBtm);fixPNG(menuTop);
 		    }
		}
		
		if($('menu-div') != null)
			$('menu-div').style.display='block';
		if($('langmenu-bottom') != null)
			$('langmenu-bottom').update(menuBtm);
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)){fixPNG(menuBtm);}
	}
	
	HeaderNav = Data.getHeaderLabel(selectedLang, selectedSource);
	var suppMenuBtn = new Element('label').update(HeaderNav[5].strip());
	$('menu-top').update(suppMenuBtn);
	/*Event.observe(suppMenuBtn, 'click', function(event) {
		if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
			alert("Please select a title.");
		else
			loadHome();
	});	
	
	Event.observe(suppMenuBtn, 'mouseover', function(event) {
		suppMenuBtn.addClassName('onhover');
	});
	Event.observe(suppMenuBtn, 'mouseout', function(event) {
		suppMenuBtn.removeClassName('onhover');
	});*/
	var whatIsBtn = new Element('label').addClassName('button').update(HeaderNav[0].strip());
	Event.observe(whatIsBtn, 'click', function(event) {
		if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
			alert("Please select a title.");
		else
			buildHome("WhatIsDigitalCopy");
	});	
	$('menu-content').update(whatIsBtn).insert("<br>");
	Event.observe(whatIsBtn, 'mouseover', function(event) {
		whatIsBtn.addClassName('onhover');
	});
	Event.observe(whatIsBtn, 'mouseout', function(event) {
		whatIsBtn.removeClassName('onhover');
	});
	
	/*var homeBtn = new Element('label').addClassName('button').update("How it Works");
	Event.observe(homeBtn, 'click', function(event) {
		if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
			alert("Please select a title.");
		else
			buildHome("HowItWorks");
	});	
	$('menu-content').insert(homeBtn).insert("<br>");
	Event.observe(homeBtn, 'mouseover', function(event) {
		homeBtn.addClassName('onhover');
	});
	Event.observe(homeBtn, 'mouseout', function(event) {
		homeBtn.removeClassName('onhover');
	});*/
	
/*	var menuBtn = new Element('label').update("Available Titles").setStyle({color:'#C0C0C0'});
	$('menu-content').insert(menuBtn).insert("<br>");
	
	var menuBtn = new Element('label').update("Upcoming Titles").setStyle({color:'#C0C0C0'});
	$('menu-content').insert(menuBtn).insert("<br>");
	
	var menuBtn = new Element('label').update("My Digital Copies").setStyle({color:'#C0C0C0'});
	$('menu-content').insert(menuBtn).insert("<br>");*/
	
	var gettingStrBtn = new Element('label').addClassName('button').update(HeaderNav[1].strip());
	Event.observe(gettingStrBtn, 'click', function(event) {
		if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
		{	alert("Please select a title");}
		else
			buildGettingStarted();
	});	
	$('menu-content').insert(gettingStrBtn).insert("<br>");
	Event.observe(gettingStrBtn, 'mouseover', function(event) {
		gettingStrBtn.addClassName('onhover');
	});
	Event.observe(gettingStrBtn, 'mouseout', function(event) {
		gettingStrBtn.removeClassName('onhover');
	});
	
	var supportBtn = new Element('label').addClassName('button').update(HeaderNav[2].strip());
	Event.observe(supportBtn, 'click', function(event) {
		if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
			alert("Please select a title");
		else
		buildSupport();
	});	
	Event.observe(supportBtn, 'mouseover', function(event) {
		supportBtn.addClassName('onhover');
	});
	Event.observe(supportBtn, 'mouseout', function(event) {
		supportBtn.removeClassName('onhover');
	});
	$('menu-content').insert(supportBtn).insert("<br>");
	
	
	var titleBtn = new Element('label').addClassName('button').update(HeaderNav[3].strip());
	Event.observe(titleBtn, 'click', function(event) {
		buildLandingPage();
	});	
	Event.observe(titleBtn, 'mouseover', function(event) {
		titleBtn.addClassName('onhover');
	});
	Event.observe(titleBtn, 'mouseout', function(event) {
		titleBtn.removeClassName('onhover');
	});
	$('menu-content').insert(titleBtn)
	
//	 /*	
	var langmenuBtn = new Element('label').update();
	
	if(selectedSection != 'Privacy' && selectedSection != 'Terms')
	{
		//$('menu-content');.insert("<br>");
	//	$('menu-content').insert(langmenuBtn);//.insert("<br>");
	}
//	*/
	
	
	if(obj != null && obj != undefined)
	{   //updated code for optimization of LangList
		
		showhideLangList(true,selectedLang,selectedSection);
		
		var langList = new Element('div');
		var menuBtn = new Element('img',{src:'images/common/menu_btn.png',width:'27px',height:'27px'});
		
		//langList.update(new Element('lh').addClassName('header').update(obj.languageNav.label));
	//	langmenuBtn.update(obj.languageNav.label);
		//$('langmenu-topimg').update(menuBtn).insert("<br>");
		
		/*
		    obj.languageNav.list.each(function(item) {
			
			var langBtn = new Element('label').addClassName('button').update(item.label);
	
			Event.observe(langBtn, 'click', function(event) {
				localizePage(item.id);
			});	
			Event.observe(langBtn, 'mouseover', function(event) {
				langBtn.addClassName('onhover');
			});
			Event.observe(langBtn, 'mouseout', function(event) {
				langBtn.removeClassName('onhover');
			});
			
			langList.insert(langBtn).insert("<br>");
		});	
		$('langmenu-content').update(langList);
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)){fixPNG(menuBtn);}
		
		  */
	}
	
  /*	
  var landPageBtn = new Element('label').addClassName('button maindc').update(HeaderNav[4].strip());
	Event.observe(landPageBtn, 'click', function(event) {
		window.location.href='/home/';
	});	
	Event.observe(landPageBtn, 'mouseover', function(event) {
		landPageBtn.addClassName('onhover');
	});
	Event.observe(landPageBtn, 'mouseout', function(event) {
		landPageBtn.removeClassName('onhover');
	});
	if(selectedSection == 'Privacy' || selectedSection == 'Terms')
	{
		langmenuBtn.update();
		$('langmenu-content').update();
		$('langmenu-content').update(landPageBtn);
	}
	else
	$('langmenu-content').insert(landPageBtn);
	
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(menuBtm);fixPNG(menuTop);
    }
	
	
	
	*/
	
}

/**
*	Build Header
*/
function buildHeader() {

	// display logo/header
	
//	$('logo-content').addClassName('button').update(Data.getHeader(selectedLang, selectedSource));
	
/*	Event.observe($('logo'),'click',function(event){
		buildHash("landing-content");
		checkHash();
	});
	
	Event.observe($('menu'),'click',function(event){
		buildPopupMenu();
	});
	
	HeaderNav = Data.getHeaderLabel(selectedLang, selectedSource);
	log('Selected Source: '+HeaderNav.length);
	
	//if the selected source is "EC" then do not show "Getting Started" button
	if(selectedSource == 'EC')
	{
		var supportHeader = '';
		if (HeaderNav.length != 0) {
		
			// create the home button
			var homeBtn = new Element('span', {id: 'home-button'}).addClassName('button').update(HeaderNav[0].strip());
			Event.observe(homeBtn, 'click', function(event) {
				homeBtn.addClassName('sectionselect');
				$('support-button').removeClassName('sectionselect');
				removeFooterHighlight();
				buildHome();
			});
			$('header-content').update(homeBtn);
			// create the support button
			var supportBtn = new Element('span', {id: 'support-button'}).addClassName('button').update(HeaderNav[1].strip());
			Event.observe(supportBtn, 'click', function(event) {
				supportBtn.addClassName('sectionselect');
				requiredInfoRedirect = 'Support';
				$('home-button').removeClassName('sectionselect');
				removeFooterHighlight();
				selectedTopSupportQue="";
				buildSupport();
			});
			$('header-content').insert(supportBtn);
		}
	}
	else if (HeaderNav.length != 0) {
	
		// create the home button
		var homeBtn = new Element('span', {id: 'home-button'}).addClassName('button').update(HeaderNav[0].strip());
		Event.observe(homeBtn, 'click', function(event) {
			homeBtn.addClassName('sectionselect');
			$('gettingstarted-button').removeClassName('sectionselect');
			$('support-button').removeClassName('sectionselect');
			removeFooterHighlight();
			buildHome();
		});
		$('header-content').update(homeBtn);
		
		// create the getting started button
		var gettingstartedBtn = new Element('span', {id: 'gettingstarted-button'}).addClassName('button').update(HeaderNav[1].strip());
		Event.observe(gettingstartedBtn, 'click', function(event) {
			gettingstartedBtn.addClassName('sectionselect');
			$('home-button').removeClassName('sectionselect');
			$('support-button').removeClassName('sectionselect');
			removeFooterHighlight();
			requiredInfoRedirect = 'GettingStarted';
			buildGettingStarted();
		});
		$('header-content').insert(gettingstartedBtn);
		
		// create the support button
		var supportBtn = new Element('span', {id: 'support-button'}).addClassName('button').update(HeaderNav[2].strip());
		Event.observe(supportBtn, 'click', function(event) {
			supportBtn.addClassName('sectionselect');
			$('home-button').removeClassName('sectionselect');
			$('gettingstarted-button').removeClassName('sectionselect');
			removeFooterHighlight();
			requiredInfoRedirect = 'Support';
			selectedTopSupportQue="";
			buildSupport();
		});
		$('header-content').insert(supportBtn);
	}*/
}

/**
*	Build Landing Page
*/
function buildLandingPage() {
	log('build landing page : ' + 'data/landingpage_' + selectedLang + '.xml');
	
	//build the unique user id
	buildUserID();
	log('User ID: '+userID);

		selectedSection = "LandingPage";
		
		positionMainContent(selectedSection);
		sendInfoToOmniture(selectedSection);
		buildHash("landing-content");
		var src = 'DC';
		if(selectedSource != false)
			src =selectedSource;
			
		Event.observe($('logo-header'),'click',function(event){
			window.location.href='/home/';
		});
		
		// create landing page container
		var landingDiv = new Element('div', {id: 'landing-content',name:'landing-content'});
	
		// create middle div that will contain the overview and top support questions list
		var middleDiv = new Element('div', {id: 'middle'} );
		landingDiv.insert(middleDiv)	
		log('LandingPage: '+LandingPage.getDCSupportLabel(selectedLang));
		
		
		// display digital copy
		var dcLabel = new Element('div',{id:'dc-label'}).addClassName('header').update(Data.welcomelabel[selectedLang].label);
		var dcSubLabel = new Element('div',{id:'dc-sublabel'}).addClassName('subheader').update(Data.welcometxtlabel[selectedLang].label);
		dcLabel.insert("<br>");
		dcLabel.insert(dcSubLabel);
		middleDiv.insert(dcLabel);
		
		var spaceDiv = new Element('div').setStyle({height:'40px'});
		middleDiv.insert(spaceDiv);
		
		var comboDiv = new Element('div',{id:'comboDiv'}).setStyle({'text-align':'center'}); 
		var countryDiv = new Element('div',{id:'country-group'});
		var countryLabel = new Element('span',{id:'country-label'}).addClassName('dd-label').update(Data.selectcountrylabel[selectedLang].label);
		var req = new Element('span').addClassName('required').update('*');
		var countryComboDiv = new Element('div',{id:'country-combo'});
		var countryCombo=new Element('select',{id:'countrylist'}).update(LandingPage.getTitleLabel(selectedLang));
		countryComboDiv.insert(countryCombo);
		countryLabel.insert(req);
		countryDiv.insert(countryLabel);
		countryLabel.insert(req);
		
		comboDiv.insert(countryDiv);
		comboDiv.insert(countryComboDiv);
		
		
		//==============================================Change from normal flow to new country flag selection flow=============
		//$('main-content').update(landingDiv);
		//buildFlagSelection();
		//===================================================================================================================
		
		
		 middleDiv.insert(comboDiv);
		//build edit title combo
		var dvdTitleDiv = new Element('div',{id:'title-group-ec',height:'auto'}).addClassName('hidden');
		var dvdTitleLabel = new Element('span',{id:'dvdtitle-label-ec'}).addClassName('dd-label').update();
		var req = new Element('span').addClassName('required').update('*');
		var dvdTitleCombo=new Element('select',{id:'dvdtitle-ec'}).setStyle({float:'left'});
		dvdTitleDiv.insert(dvdTitleLabel);
		dvdTitleLabel.insert(req);
		dvdTitleDiv.insert("<br>");
		dvdTitleDiv.insert(dvdTitleCombo);
		
		//build Submit button
		var submitLabel = new Element('input',{type:'button', id:'gobutton-ec',value:"Go"}).addClassName('go-button');
		dvdTitleDiv.insert(submitLabel);
		middleDiv.insert(dvdTitleDiv);
	
		$('main-content').update(landingDiv);
		showEditTitle(selectedLang);
		buildCountryList();		
		
			$('gobutton-ec').observe('click', function(){
			
			if ($F('dvdtitle-ec') == Data.selectlabel[selectedLang].label || $F('dvdtitle-ec') ==null) {	
				$('dvdtitle-ec').focus();
				$('dvdtitle-ec').addClassName('highlight');
				alert(Data.requesterror[selectedLang].fillrequiredfields);
			}
			else{
				selectedTitle = $F('dvdtitle-ec');
				setSource(getDiscSource(selectedTitle));
				setTitle($F('dvdtitle-ec'));
				log('selectedTitle: '+selectedTitle);
					buildEC(selectedLang);
			}
		});
		
		
			
		buildStoredInfo();
		buildLanguageSelector(LandingPage);
		buildCopyright();
		clearCountrySelector();	
		clearUpdates();
		
		
}

/**
 * 
 */
function buildFlagSelection(){
	//build div for flag images
	 
     var mainflagDiv = new Element('div', {id:'mainflagDiv'});
	var cntr=0;
	 Data.flagselection.each(function(item) {
	
	 
	 var flagDiv = new Element('div', {id:'flagBox'});
	 flagDiv.setStyle({float:"left"});
	 var flagItemDiv = new Element('div', {id:'flagboxContent'});
	 var flagImg = new Element('img',{src:item.imgpath,width:'24px',height:'17px'});
	 var flagLabel = new Element('span',{id:'flagLabel'});
	 
	  Event.observe(flagDiv, 'click', function(event){
			loadAutoComplete(item.id);
			setCountry(item.id);
			selectedCountry = item.id;
			setLanguage(LandingPage.getlanguageID(item.id));
		});
	  Event.observe(flagDiv, 'mouseover', function(event) {
		  flagLabel.addClassName('flagcontentOver');
		});
	  Event.observe(flagDiv, 'mouseout', function(event) {
		  flagLabel.removeClassName('flagcontentOver');
	  });
	 
	 
	 
	 flagItemDiv.insert(flagImg);
	 flagLabel.insert(item.label)
	 flagItemDiv.insert('<br/>').insert(flagLabel);
	
	 flagDiv.insert(flagItemDiv);
	 mainflagDiv.insert(flagDiv);
	 flagItemDiv.addClassName('flagcontentOver');
	 if(cntr == 4){
		 
		 var spaceDiv = new Element('div').setStyle({clear:'left'});
		 mainflagDiv.insert(spaceDiv);
	     cntr=0;
			
		 }
		 else{cntr+=1;}
	});
	
	$('middle').insert(mainflagDiv);
}
function loadAutoComplete(country){
	$('mainflagDiv').update('');
	
	
	var autodvdtitleDiv = new Element('div', {id:'autodvdtitleDiv'});
	var dvdautoTitleCombo=new Element('input',{id:'autodvdtitle',size:'55'});
	var hintsDiv = new Element('div', {id:'hints'});
	var dvdTitleLabel = new Element('span',{id:'dvdtitle-label'}).addClassName('autoselectTitle').update(LandingPage.getTitleLabel(selectedLang));
	
	autodvdtitleDiv.insert(dvdTitleLabel);
	autodvdtitleDiv.insert(dvdautoTitleCombo);
	autodvdtitleDiv.insert(hintsDiv);
	
	
	
	$('mainflagDiv').insert(autodvdtitleDiv);
	$("hints").hide();
	var dvdGoDiv = new Element('div',{id:'dvd-go'});
	var submitLabel = new Element('input',{type:'button', id:'gobutton',value:"Go"}).addClassName('go-button');
	dvdGoDiv.insert(submitLabel);
	
	$('mainflagDiv').insert(dvdGoDiv);
	$('gobutton').value =LandingPage.getGoButtonText(selectedLang);
	$('autodvdtitle').focus();
	onTypeBAhead(country);
	 
	$('gobutton').observe('click', function(){
		try{
		var autoFlag = false;
		if(test.selectedTitle)
		{
			//alert("selected Title Info" + test.selectedTitle.id);
			//only proceed to next step if whats in input box matches actual title
			//alert($('autodvdtitle').value +" =?" + test.selectedTitle.title );
			//alert(test.exactMatch($('autodvdtitle').value));
			
			if(test.selectedTitle.title == $('autodvdtitle').value )
			{	//alert("proceed to next page" + test.selectedTitle.id);
				autoFlag = true;
			}
			else if(test.exactMatch($('autodvdtitle').value) == true)
			{
				//alert("User typed in exact match proceed" +test.selectedTitle.id);
				autoFlag = true;
			}
			else{
			alert("That title is not recognized please check correct spelling");
			autoFlag = false;
			}
			if(autoFlag == true){
				
				var disc_Source;
				selectedTitle = test.selectedTitle.id;
				if(discInfo==null)
				discInfo = gatherSingleDiscInfo(selectedTitle);
				if(getspecificdiscInfo('source','DCON',selectedTitle) == 'DCON')
					disc_Source = 'DCON';
				else if(getspecificdiscInfo('source','DCOD',selectedTitle) == 'DCOD')	
					disc_Source = 'DCOD';
				selectedSource = disc_Source;	
//				alert(disc_Source);
//				alert(test.selectedTitle.id);
//				alert(country);
				setSource(disc_Source);
				
				
				setTitle(test.selectedTitle.id);				
				buildDC(selectedLang);
				authorizationCode='';
			}
		
		}
		else if(test.exactMatch($('autodvdtitle').value) == true)
		{
			//alert("User typed in exact match proceed" +test.selectedTitle.id);
			autoFlag = true;
		}
		else{alert("That title is not recognized please check correct spelling");autoFlag = false;}	
		if(autoFlag == true){
			var disc_Source;
			selectedTitle = test.selectedTitle.id;
			if(discInfo==null)
			discInfo = gatherSingleDiscInfo(selectedTitle);
			if(getspecificdiscInfo('source','DCON',selectedTitle) == 'DCON')
				disc_Source = 'DCON';
			else if(getspecificdiscInfo('source','DCOD',selectedTitle) == 'DCOD')	
				disc_Source = 'DCOD';
			//selectedSource = disc_Source;	
			//alert(disc_Source);
			setSource(disc_Source);
			setTitle(test.selectedTitle.id);				
			buildDC(selectedLang);
			//buildDC('en');
			authorizationCode='';
		}
		}catch(e){alert(e);}
	});
	 
	//$("autodvdtitle").observe("focus",this.onFocusDistrict);
	//$("autodvdtitle").observe("keyup",this.onKeyEntry);
	//$("theaterCircuitNext").observe("focus",this.onFocusName);
	//$("divRegForm").observe("click",this.onClickContainer);
	//$("hints").hide();
	
}

function buildCountryList()
{
	if(selectedLang == '')
		selectedLang = 'en'; 
	if($('dvdtitle') != null)
	$('dvdtitle').update(new Element('option').update(Data.selectlabel[selectedLang].label));
	$('countrylist').update(new Element('option').update(Data.selectlabel[selectedLang].label));
	$('country-label').update(Data.selectcountrylabel[selectedLang].label).insert(new Element('span').update('*').addClassName('required'));
	
	LandingPage.digitalcopy.languages.each(function(item) {
		$('countrylist').insert(new Element('option', {value: item.countryid}).update(item.label));
	});
	$('countrylist').observe('change', function () {
		if($F('countrylist').length <= 2){
			//localizePage(LandingPage.getlanguageID($F('countrylist')));
			setCountry($F('countrylist'));
			setLanguage(LandingPage.getlanguageID($F('countrylist')));
			showEditTitle(LandingPage.getlanguageID($F('countrylist')));
			buildTitleMap();
			buildCopyright();
			
			if(!useDTM)
			{
				$('dvdtitle').style.disabled='false';
				$('dvdtitle').style.width='auto';
			}
			
		}
		else
		{
			$('dvdtitle').update(new Element('option',{disabled:'true'}).update(Data.selectlabel[selectedLang].label)).setStyle({width:'350px'});
			var dvdTitleLabel = new Element('span',{id:'dvdtitle-label'}).addClassName('dd-label').update(LandingPage.getTitleLabel(selectedLang));
		}	
	});
}

/**
 * This method shows up the edit title combo box on the landing page for Extra Content.
 * @param {} lang
 */
function showEditTitleEC(lang)
{
	selectedSource = "EC";
	var submitLabel = new Element('input',{type:'button', id:'gobutton',value:"Go"}).addClassName('go-button').setStyle({float:'left'});
	
	if($('dvdtitle') != null)
	{
		Element.remove($('dvdtitle'));
		Element.remove($('gobutton'));
	}
	if($('dvdtitle') == null)
	{
		var dvdTitleCombo=new Element('select',{id:'dvdtitle'}).setStyle({float:'left'});
		$('title-group').insert(dvdTitleCombo);	
		$('title-group').insert(submitLabel);
	}
	buildTitleMap();
	if ($('title-group-ec').hasClassName('hidden') == true)
		$('title-group-ec').removeClassName('hidden');
	$('dc-label').update(LandingPage.getDCSupportLabel(lang));
//	$('ec-label').update(LandingPage.getECSupportLabel(lang));
	$('dvdtitle-label-ec').update(LandingPage.getTitleLabel(lang)).insert(new Element('span').update('*').addClassName('required'));
	$('gobutton-ec').value =LandingPage.getGoButtonText(lang);
//	$('logo-content').addClassName('button').update(Data.getHeader(selectedLang, selectedSource));
}


/**
 * This method shows up the edit title combo box on the landing page
 */
function showEditTitle(lang)
{
	selectedSource = "DC";
	
	if($('title-group') == null){
	
	var dvdTitleDiv = new Element('div',{id:'title-group'});
	var dvdTitleLabel = new Element('span',{id:'dvdtitle-label'}).addClassName('dd-label').update();
	var req = new Element('span').addClassName('required').update('*');
	var dvdComboDiv = new Element('div',{id:'dvd-combo'}).addClassName("group");
	var dvdGoDiv = new Element('div',{id:'dvd-go'});
	//IE fix -- combobox resize. Added the combo in showEditTitle method
	//var dvdTitleCombo=new Element('select',{id:'dvdtitle'});
	dvdComboDiv.insert(dvdTitleLabel);
	dvdTitleLabel.insert(req);
	dvdTitleDiv.insert(dvdComboDiv);
	$('comboDiv').insert(dvdTitleDiv);
	dvdTitleDiv.insert("<br>");
	dvdTitleDiv.insert(dvdGoDiv);
	}
			
	
	var submitLabel = new Element('input',{type:'button', id:'gobutton',value:"Go"}).addClassName('go-button');
	
	if($('dvdtitle') != null)
	{
		Element.remove($('dvdtitle'));
		Element.remove($('gobutton'));
	}
	
  if(!useDTM)
  {
	if($('dvdtitle') == null )
	{
		var dvdTitleCombo=new Element('select',{id:'dvdtitle'}).update();
		$('dvd-combo').insert(dvdTitleCombo);
		$('dvd-go').insert(submitLabel);
		$('countrylist').observe('click',function(){
			$('dvdtitle').style.width='auto';
		});
	}
  }
  else{
	if($('autodvdtitle') == null )
	{
		
		var dvdautoTitleCombo=new Element('input',{id:'autodvdtitle',size:'55'});
		var auto_arrow = new Element('img',{src: 'images/common/auto_arrow.gif',id:'auto_arrow',align:"absbottom",width:'25px', height:'22px'}).addClassName('button');
		
		$('dvd-combo').insert(dvdautoTitleCombo);
		$('dvd-combo').insert(auto_arrow);
		var dcopyautocomplete = new Autocomplete('autodvdtitle',
 				 { serviceUrl:'autocomplete/autocomplete.ashx',
				   width: 355,
				   onSelect: function(value, data)
				   			 {
						        //alert('You selected: ' + value + ', ' + data);
								handledynamicTitleMap(value,data);
     						 }
 		}, 'auto_arrow');
		$('dvd-go').insert(submitLabel);
	}
  }
		
	if ($('title-group').hasClassName('hidden') == true)
		$('title-group').removeClassName('hidden');
//	$('dc-label').update(LandingPage.getDCSupportLabel(lang));
//	$('ec-label').update(LandingPage.getECSupportLabel(lang));
	$('dvdtitle-label').update(LandingPage.getTitleLabel(lang)).insert(new Element('span').update('*').addClassName('required'));
	$('country-label').update(Data.selectcountrylabel[selectedLang].label).insert(new Element('span').update('*').addClassName('required'));
	
	
	$('gobutton').value =LandingPage.getGoButtonText(lang);
	
	//$('logo-content').addClassName('button').update(Data.getHeader(selectedLang, selectedSource));
	$('gobutton').stopObserving('click');
	$('gobutton').observe('click', function(){
		 
				if(!useDTM)
				{discInfo=null;
					if ($F('dvdtitle') == Data.selectlabel[selectedLang].label || $F('dvdtitle') ==null) {	
						$('dvdtitle').focus();
						$('dvdtitle').addClassName('highlight');
						if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
							modalWin(Data.requesterror[selectedLang].fillrequiredfields);
						else
							alert(Data.requesterror[selectedLang].fillrequiredfields);
					}
				   else if($F('dvdtitle')  == 'FILM2HOMELIVE' || $F('dvdtitle')  == 'FILM2HOMEDEV'){
					   visit("http://www.yourdigitalcopy.com/DigitalCopySupport.aspx?lang="+selectedLang);
				   }
					else{
						// store selected data
						selectedTitle = $F('dvdtitle');
						setSource(getDiscSource(selectedTitle));
						setTitle($F('dvdtitle'));
						
						//073DBCF5-9689-462F-8491-E7B87EB65931 The clique Blu-ray
						buildDC(selectedLang);
						authorizationCode='';
					}
				}
				else{
					//alert(dynamictitlemapData);
					var disc_Source;
					selectedTitle = '95D4C3DB-0BCB-40fe-ABB7-F06E16D9F23A';
					discInfo = gatherSingleDiscInfo(selectedTitle);
					if(getspecificdiscInfo('source','DCON',selectedTitle) == 'DCON')
						disc_Source = 'DCON';
					else if(getspecificdiscInfo('source','DCOD',selectedTitle) == 'DCOD')	
						disc_Source = 'DCOD';
					//selectedSource = disc_Source;	
					//alert(disc_Source);
					setSource(disc_Source);
					setTitle(dynamictitlemapData);				
					buildDC(selectedLang);
					authorizationCode='';
					
					
				}
		});
}
function handledynamicTitleMap(value, data){
	//set data so i can access it later
	//value = TitleName
	//data = discId, edition
	data= '95D4C3DB-0BCB-40fe-ABB7-F06E16D9F23A';
	dynamictitlemapData = data;

}
/**
 * Builds the user id and stores it in cookie
 */
function buildUserID()
{
	var randomnumber = Math.floor(Math.random()*10001);
	var date = new Date();
	var time = '';
	var year = date.getYear();
	if (year < 2000) year = 1900 + year;
	
	time = time+(date.getMonth()+1)+""+date.getDate()+""+year+""+date.getHours()+""+date.getMinutes()+""+date.getSeconds()+""+date.getMilliseconds();
	
	userID ="UID"+randomnumber+""+time;
	
//	userID.replace(/'//g,""); 
//	userID.replace(/:/g,"");
//	userID.replace(/&/g,"");
	setUserID(userID);
}

/**
*	Build Footer
*/
function buildFooter() {
/*	log('build footer in selected lang ' + selectedLang);
	
	if(Footer.getLabel(selectedLang, 'feedbacklabel') == undefined)
	{
		Footer.loadXML();
	}
	else
	{
		// create the feedback button
		var feedbackBtn = new Element('span', {id: 'feedback-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'feedbacklabel'));
		Event.observe(feedbackBtn, 'click', function(event) {
			removeHeaderHighlight();
			feedbackBtn.addClassName('sectionselect');
			$('privacy-button').removeClassName('sectionselect');
			$('terms-button').removeClassName('sectionselect');
			buildFeedback();
		});
		$('footer-content').update(feedbackBtn);
	
		// create the privacy button
		var privacyBtn = new Element('span', {id: 'privacy-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'privacylabel'));
		Event.observe(privacyBtn, 'click', function(event) {
			removeHeaderHighlight();
			privacyBtn.addClassName('sectionselect');
			$('feedback-button').removeClassName('sectionselect');
			$('terms-button').removeClassName('sectionselect');
			buildPrivacy();
		});
		$('footer-content').insert(privacyBtn);
		
		// create terms-of-use button
		var termsBtn = new Element('span', {id: 'terms-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'termslabel'));
		Event.observe(termsBtn, 'click', function(event) {
			removeHeaderHighlight();
			termsBtn.addClassName('sectionselect');
			$('privacy-button').removeClassName('sectionselect');
			$('feedback-button').removeClassName('sectionselect');
			buildTerms();
		});
		$('footer-content').insert(termsBtn);
	} */
}

/**
*	Build Copyright
*/
function buildCopyright() {
	if(Footer.getLabel(selectedLang, 'feedbacklabel') == undefined)
	{
		Footer.loadXML();
	}
	else
	{
		// create the About button
	/*	var aboutBtn = new Element('span', {id: 'feedback-button'}).addClassName('button').update("About");
		Event.observe(aboutBtn, 'click', function(event) {
			
		});
		$('copyright').update(aboutBtn).insert("&nbsp;&nbsp;|&nbsp;&nbsp;");*/
		// create the feedback button
		var feedbackBtn = new Element('span', {id: 'feedback-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'feedbacklabel'));
		Event.observe(feedbackBtn, 'click', function(event) {
			if(getTitle() == null ||getTitle() == undefined || getTitle() == false)
				alert("Please select a title.");
			else
				{buildFeedback();}
		});
		$('copyright').update(feedbackBtn).insert("&nbsp;&nbsp;|&nbsp;&nbsp;");;
	
		// create the privacy button
		var privacyBtn = new Element('span', {id: 'privacy-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'privacylabel'));
		Event.observe(privacyBtn, 'click', function(event) {
			buildPrivacy();
		});
		$('copyright').insert(privacyBtn).insert("&nbsp;&nbsp;|&nbsp;&nbsp;");
		
		// create terms-of-use button
		var termsBtn = new Element('span', {id: 'terms-button'}).addClassName('button').update(Footer.getLabel(selectedLang, 'termslabel'));
		Event.observe(termsBtn, 'click', function(event) {
			buildTerms();
		});
		var today = new Date();
		var copy = Copyright.getLabel(selectedLang);
		$('copyright').insert(termsBtn).insert("&nbsp;&nbsp;|&nbsp;&nbsp;");
		$('copyright').insert("&copy; "+today.getFullYear()+" "+copy);
//	if($('copyright')!=null)
//		$('copyright').update("About | Contact | Privacy | Terms of Use | Warner Bros. All Rights Reserved");
//	$('copyright').update(Copyright.getLabel(selectedLang));
}
}
/**
 * Removes the highlight on the header buttons.
 */
function removeHeaderHighlight()
{
	if($('home-button') != null && $('home-button').hasClassName('sectionselect'))
		$('home-button').removeClassName('sectionselect');
	if($('gettingstarted-button') != null && $('gettingstarted-button').hasClassName('sectionselect'))
		$('gettingstarted-button').removeClassName('sectionselect');
	if($('support-button') != null && $('support-button').hasClassName('sectionselect'))
		$('support-button').removeClassName('sectionselect');	
}

/**
 * Removes the highlight on the footer buttons.
 */
function removeFooterHighlight()
{
	if($('feedback-button') != null && $('feedback-button').hasClassName('sectionselect'))
		$('feedback-button').removeClassName('sectionselect');
	if($('privacy-button') != null && $('privacy-button').hasClassName('sectionselect'))
		$('privacy-button').removeClassName('sectionselect');
	if($('terms-button') != null && $('terms-button').hasClassName('sectionselect'))
		$('terms-button').removeClassName('sectionselect');	
}

/**
*	Build Feedback form
*/
function buildFeedback() {
	
	if (FeedbackForm.language == undefined || FeedbackForm.language != selectedLang ) {
		
		log('load the feedback form xml');
		loadFeedbackForm();
		
	} else {
		
		selectedSection = "Feedback";
		positionMainContent(selectedSection);
		if(document.location.hash.include("inapp"))
		{buildHash("feedback-content&inapp=true&code="+authorizationCode);
			//alert("buildfeedbackform - in app true");
		}	else buildHash("feedback-content");
		log('display the feedback form');
		
		// create feedback-content container
		var feedbackDiv = new Element('div', {id: 'feedback-content', name:'feedback-content'});
		
		// create middle div
		var middleDiv = new Element('div', {id: 'middle'} );
		feedbackDiv.insert(middleDiv);

		// display text (ie 'Please submit the feedback form')
		var faqDiv = new Element('div').addClassName('faq');
		middleDiv.insert(faqDiv);

		// display instructions	
		var instructDiv = new Element('div',{id:'instructdiv'}).addClassName('feedbackquestion').update();
		faqDiv.insert(instructDiv);
		
		
		//dvd title drop down
		var dvdTitleDiv = new Element('div').addClassName('group');
		var dvdTitleLabel = new Element('span',{id:'dvdtitle-label'}).addClassName('dd-label dvdlabel').update(SupportForm.label);
		var dvdTitleCombo=new Element('select',{id:'dvdtitle'});
		dvdTitleDiv.insert(dvdTitleLabel);
		dvdTitleDiv.insert(dvdTitleCombo);
		faqDiv.insert(dvdTitleDiv);
		
		//build feature
		var featureDiv = new Element('div').addClassName('group');
		var featureLabel = new Element('span',{id:'feature-label'}).addClassName('dd-label').update();
		var req = new Element('span').addClassName('required').update('*');
		var featureCombo=new Element('select',{id:'feature',width:'100'});
		featureDiv.insert(featureLabel);
		featureLabel.insert(req);
		featureDiv.insert(featureCombo);
		faqDiv.insert(featureDiv);
		
		//build rate
		var expDiv = new Element('div').addClassName('group');
		var expLabel = new Element('span',{id:'rate-label'}).addClassName('dd-label').update();
		var req = new Element('span').addClassName('required').update('*');
		var expCombo=new Element('select',{id:'rate'});
		expDiv.insert(expLabel);
		expLabel.insert(req);
		expDiv.insert(expCombo);
		faqDiv.insert(expDiv);
		
		//build comments
		var commentsDiv = new Element('div').addClassName('group');
		var commentsLabel = new Element('span',{id:'comments-label'}).addClassName('dd-label').update();
		var comments=new Element('textarea',{id:'comments',cols:'48'});
		commentsDiv.insert(commentsLabel);
		commentsDiv.insert(comments);
		faqDiv.insert(commentsDiv);
	
		//build link to support form
		var reportDiv = new Element('div').addClassName('group');
		var reportLabel = new Element('p',{id:'report-label'}).update();
		reportDiv.insert(reportLabel);
		faqDiv.insert(reportDiv);
		
		//build Submit button
		var submitDiv = new Element('div',{align:'center'});
		var submitLabel = new Element('input',{type:'button', id:'submitfeedback',value:"Submit"});
		submitDiv.insert(submitLabel);
		faqDiv.insert(submitDiv);
		
		$('main-content').update(feedbackDiv);
		buildTitleMap();
		Event.observe($('rate'), 'change', function () {
			$('rate').removeClassName('highlight');
		});	
		Event.observe($('feature'), 'change', function () {
			$('feature').removeClassName('highlight');
		});
		
		FeedbackForm.groups.each(function(item){
			
						
					if(item.id=='feature')
						{
							item.selection.each(function(sel){
									$('feature').insert(new Element('option').update(sel));
								})
						}
					else if(item.id=='rate')
					{
						item.selection.each(function(sel){
							$('rate').insert(new Element('option').update(sel));
						})	
					}	
		});
		
		$('instructdiv').update(FeedbackForm.label);
		$('dvdtitle-label').update(FeedbackForm.getTextLabel('title')).insert(new Element('span'));
		$('feature-label').update(FeedbackForm.getTextLabel('feature')).insert(new Element('span').update('*').addClassName('required'));
		$('rate-label').update(FeedbackForm.getTextLabel('rate')).insert(new Element('span').update('*').addClassName('required'));
		$('comments-label').update(FeedbackForm.getTextLabel('comments'));
		
		if('PID'== getDiscCollection(selectedTitle,'PID'))
		{
		$('report-label').update(FeedbackForm.getTextLabel('report'));
		}
		else{$('report-label').update(FeedbackForm.getTextLabel('report'));}
		
		
		
		$('submitfeedback').value=FeedbackForm.getTextLabel('submit');
		
		$('submitfeedback').observe('click',function(){
			
			
			if($('submitfeedback').hasClassName('disabled')) {
				log('Button is disabled. Disallowing request.');
				return;
			}
			
			$('submitfeedback').addClassName('disabled');
			
			
			
			if ($F('rate') == Data.selectlabel[selectedLang].label || $F('rate') == null) {	
				$('rate').focus();
				$('rate').addClassName('highlight');
				$('submitfeedback').removeClassName('disabled');
				if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
					modalWin(Data.requesterror[selectedLang].fillrequiredfields);
				else
					alert(Data.requesterror[selectedLang].fillrequiredfields);
	
		   }else if ($F('feature') == Data.selectlabel[selectedLang].label || $F('feature') ==null) {	
				$('feature').focus();
				$('feature').addClassName('highlight');
				$('submitfeedback').removeClassName('disabled');
				//for japanese language show the error msg in a modal window.
				if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
					modalWin(Data.requesterror[selectedLang].fillrequiredfields);
				else
					alert(Data.requesterror[selectedLang].fillrequiredfields);
				
		   } else
		   {
				log('submit feedback form');
				//-- user input
				log('rate: ' + $F('rate'));
				log('feature: ' + $F('feature'));
				log('comments: ' + $F('comments'));
				
				//cookies
				log('selectedCountry: ' + selectedCountry);
				log('selectedLang: ' + selectedLang);
				log('selectedMediaType: ' + selectedMediaType);
				log('selectedOS: ' + selectedOS);
				log('selectedRequestType: ' + selectedRequestType);
				log('selectedSection: ' + selectedSection);
				log('selectedSource: ' + selectedSource);
				log('selectedTitle: ' + $F('dvdtitle'));
				
				
				var omniVars = new Object();
				var formatOmniture = '';
				omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
				omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
				omniVars.prop5 = userID; 
				omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle($F('dvdtitle'))+": "+getDiscEdition($F('dvdtitle'));
				omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource($F('dvdtitle'));
				if(getDiscFormat($F('dvdtitle'),'WMV') != '')
				{
					if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
					{
						formatOmniture = getDiscFormat($F('dvdtitle'),'WMV')+" and "+getDiscFormat($F('dvdtitle'),'iTunes');
					}
					else
					{
						formatOmniture = getDiscFormat($F('dvdtitle'),'WMV');
					}
				}
				else
				{
					if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
					{
						formatOmniture = getDiscFormat($F('dvdtitle'),'iTunes');
					}
				}
				omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+formatOmniture;
				omniVars.prop35 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('rate');
				omniVars.prop35 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('feature');
				doOmnitureTrackData(omniVars);
				
				var vendor = getDiscProvider($F('dvdtitle'));
				log('VENDOR: ' + vendor);
				var vendorEmail = Data.getProviderEmail(vendor);
			
				
				log('VENDOR EMAIL: ' + 'wbdd@wb.com');
				log('DISC TITLE: ' + getDiscTitle($F('dvdtitle')));
				
				
				/*var emailData = {type: 'feedback',
					rate: $F('rate'),
					feature: $F('feature'),
					comments: $F('comments'),
					country:selectedCountryConversion,
					discid:$F('dvdtitle'),
					disctitle:getDiscTitle($F('dvdtitle')),
					edition:getDiscEdition($F('dvdtitle')),
					isLoyaltyRequest:false,
					dcRequestType:"other",
					source:selectedSource,
					language:selectedLang,
					recipient:"wbdd@wb.com"
				}*/
				discInfo = gatherSingleDiscInfo($F('dvdtitle'));
				//alert(getspecificdiscInfo('getsource', ''));
				//alert(getspecificdiscInfo('getedition', '')+ "this i just created");
				//alert(getspecificdiscInfo('gettitle', ''));
				//selectedCountry
				var selectedCountryConversion = formcountryConversion(selectedCountry); 
				
				var dropdownObj = [];
				dropdownObj.push({"id":"60" , "value":"797"});
				dropdownObj.push({"id":"24" , "value":"1"});
				dropdownObj.push({"id":"77" , "value":"122"});
				
				if(paratureTranslate(34,'Other')!= "")
					dropdownObj.push({"id":"34","value":paratureTranslate(34,'Other')});
				if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) != "")
						dropdownObj.push({"id":"35","value":paratureTranslate(35,getspecificdiscInfo('gettitle', ''))});
				if(paratureTranslate(67,getspecificdiscInfo('getedition', '')) != "")
					dropdownObj.push({"id":"67","value":paratureTranslate(67,getspecificdiscInfo('getedition', ''))});
				if(paratureTranslate(62,selectedLang) != "")
					dropdownObj.push({"id":"62" , "value":paratureTranslate(62,selectedLang)});
				if(paratureTranslate(61,getspecificdiscInfo('getsource', ''))!= "")
					dropdownObj.push({"id":"61" , "value":paratureTranslate(61,getspecificdiscInfo('getsource', ''))});
							
				var entryFieldsObj = [];
				var commentsParatureField="";
				
				if($F('comments').include("&"))
				{	commentsParatureField = $F('comments');
					commentsParatureField = commentsParatureField.replace(/&/g, "&amp;"); }
				else{commentsParatureField = $F('comments');}
				entryFieldsObj.push( {"id":"28","value":commentsParatureField});
				entryFieldsObj.push( {"id":"66","value":$F('dvdtitle')});
				entryFieldsObj.push( {"id":"32","value":paratureTranslate(32,selectedCountryConversion)});
				entryFieldsObj.push( {"id":"86", "value":$F('feature')});
				entryFieldsObj.push( {"id":"87", "value":$F('rate')});
				if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) == "")
				  entryFieldsObj.push( {"id":"65", "value":getspecificdiscInfo('gettitle', '')});
				entryFieldsObj.push( {"id":"27", "value":"WB Digital Copy Support - "+getspecificdiscInfo('gettitle', '') });
				
				var emailData = $H({
					"customDropDownFields":dropdownObj,
					"customEntryFields": entryFieldsObj,
					"departmentId":"15027",
					"email":"wbdd@wb.com",
					"firstName":"digital",
					"lastName":"copy",
					"memeberOf":{"id":"33","value":"30"}
				}).toJSON();
				
				RequestForm.loadXML(emailData);
		   }
		});
		
		buildTitleMap();
		buildSectionTitle(FeedbackForm);
		if(selectedSource == 'EC')
			buildLanguageSelector();
		else
		buildLanguageSelector(FeedbackForm);
		clearCountrySelector();
		clearUpdates();
		buildStoredInfo();
		buildHeader();
		buildFooter();
		if($('feedback-button') != null)
			$('feedback-button').addClassName('sectionselect');
	}
}

/**
 * This method shows a modal window for the japanese error messages
 * @param msg
 * @return
 */
function modalWin(msg) {
	
   var myArguments = new Object();
   myArguments.param1 = msg;
   window.showModalDialog("error-jp.html", myArguments, "dialogHeight:140px; dialogWidth:350px; scroll:no; resizable:no; help:no; status:no;"); 
	
}
/**
*	Build Privacy Policy
*/
function buildPrivacy(country) {
	log('build privacy'+selectedLang);
	
	if(country != undefined){
		selectedCountry = country;
	}
		
	if (PrivacyPolicy.country == undefined || selectedCountry != PrivacyPolicy.country) {
		loadPrivacyPolicy();
		
	} else {	
		
		selectedSection = "Privacy";
	//	sendInfoToOmniture(selectedSection);
		positionMainContent(selectedSection);
		if(document.location.hash.include("inapp"))
			buildHash("privacy-content&country="+selectedCountry+"&discid="+selectedTitle+"&inapp=true&code="+authorizationCode);
		else buildHash("privacy-content&country="+selectedCountry);
		
		// create privacy-policy container
		var privacyDiv = new Element('div', {id: 'privacy-content', name:'privacy-content'});
		
		// create middle div
		var middleDiv = new Element('div', {id: 'middle'} );
		privacyDiv.insert(middleDiv);
		
		// display text
		middleDiv.update(new Element('div').setStyle( {margin: '10px'}).update(PrivacyPolicy.content));
		
		$('main-content').update(privacyDiv);
		
		buildLanguageSelector(PrivacyPolicy);
		buildStoredInfo();
		clearUpdates();
		buildSectionTitle(PrivacyPolicy);
		buildHeader();
		buildFooter();
		if($('privacy-button') != null)
			$('privacy-button').addClassName('sectionselect');
	}
}

/**
*	Build Terms of Use
*/
function buildTerms(country) {
	log('build terms');
	
	if(country != undefined){
		selectedCountry = country;
	}
	
	if (TermsOfUse.country == undefined || selectedCountry != TermsOfUse.country) {
		loadTermsOfUse();

	} else {
		 
		selectedSection = "Terms";
	//	sendInfoToOmniture(selectedSection);
		positionMainContent(selectedSection);
		if(document.location.hash.include("inapp"))
			buildHash("terms-content&country="+selectedCountry+"&discid="+selectedTitle+"&inapp=true&code="+authorizationCode);
		else buildHash("terms-content&country="+selectedCountry);
		
		// create terms of use container
		var termsDiv = new Element('div', {id: 'terms-content',name:'terms-content'});
		
		// create middle div
		var middleDiv = new Element('div', {id: 'middle'} );
		termsDiv.insert(middleDiv)	
		
		// display text
		middleDiv.update(new Element('div').setStyle( {margin: '10px'}).update(TermsOfUse.content));

		$('main-content').update(termsDiv);
	
		buildLanguageSelector();
		clearUpdates();
		buildStoredInfo();
		buildSectionTitle(TermsOfUse);
		buildHeader();
		buildFooter();
		if($('terms-button') != null)
			$('terms-button').addClassName('sectionselect');
	}
}

/**
*	Build the Digital Copy Support page
*/
function buildDC(lang) {
	
	log('build the digital copy support page in ' + lang + ' (language id)');
	
	setLanguage(lang);
	Support.language = undefined;
	GettingStarted.language = undefined;
	buildHeader();
	buildFooter();
	loadHome();
}

/**
*	Build the Online Special Features page
*/
function buildEC(lang) {
	log('build the online special features support page in ' + lang + ' (language id)');
	
	setLanguage(lang);
	Support.language = undefined;
	buildHeader();
	buildFooter();
	loadHome();
}

/**
*	Build the home section
*/
function buildHome(obj) {
	log('build home');
	if(getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==true)
	{loadPIDHome();}
	if (Home.language == undefined || selectedLang != Home.language) {
		loadHome();
	} else {
		
		
		var ref = this;
		selectedSection = "Home";
		positionMainContent(selectedSection);
		if(obj == "HowItWorks")
			buildHash("HowItWorks&discid="+selectedTitle+"&country="+selectedCountry);
		else{
			if(document.location.hash.include("inapp"))
				buildHash("WhatIsDigitalCopy&discid="+selectedTitle+"&country="+selectedCountry+"&inapp=true&code="+authorizationCode);
			else buildHash("WhatIsDigitalCopy&discid="+selectedTitle+"&country="+selectedCountry);
		}
		sendInfoToOmniture(selectedSection);
		
		// create home-content container
		var homeDiv = new Element('div', {id: 'home-content'});
		
		// draw graphic header
		/*homeDiv.insert(new Element('div', {id: 'top'}).update(   new Element('img', {src: Home.sectionheader})   ));*/

		// create middle div that will contain the overview and top support questions list
		var middleDiv = new Element('div', {id: 'middle'} );
		homeDiv.insert(middleDiv);

		// build overview label
	/*	var overviewLabel = new Element('div', {height:'15'}).addClassName('category-header-selected').update(Home.overview.label);
		middleDiv.update(overviewLabel);*/

		// build overview list
		var overviewList = new Element('ul').addClassName('faq');
		Home.overview.list.each( function(item) {
			var q = new Element('span').addClassName('header').update(item.question);
			var a = new Element('p').update(item.answer);
			overviewList.insert(new Element('li').insert(q).insert(a));
		});	
		middleDiv.insert(overviewList);
		var pidquestion = [];
		var pidqnodeOK =false;
		if(getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==true)
		{
			try{
			
			PIDHome.language.list.each( function (items){
		
				//alert(items.langid);
				items.items.each(function (content){
					if(items.langid == selectedLang)
					{	pidqnodeOK=true;
						pidquestion.push({question:content.question,qid:content.id});
					}
				});	
				
			});
			}catch(error){log(error);}	
		}
		// build topsupport label
		/*	var topsupportLabel = new Element('div', {height:'15'}).addClassName('category-header-selected').update(Home.topsupport.label);
		middleDiv.insert(topsupportLabel);*/

		//alert('building question');
		
		
		// build topsupport div
		var topsupportList = new Element('div', {id: 'topsupport-content'});
		var tslen = Home.topsupport.list.size() - 1;
		var counter = 0;
		var pidquestionct=0;
		Home.topsupport.list.each( function(item) {
			// icon 
			var i = new Element('div', {align: 'center'}).addClassName('left-cell');
			if (counter == 0 || counter == 1 || counter == 2 || counter == 3) i.insert(new Element('img', {src: 'images/common/exclaim.gif', width: '15', height: '12', border: '0', alt: '!'}));
			else i.insert(new Element('img', {src: 'images/common/rightarrow.gif', width: '9', height: '9', border: '0', alt: '>'}));

			if(getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==true && pidqnodeOK ==true)
			{   
				if(pidquestionct <=3)
				{ 
						//alert(pidquestion[pidquestionct].qid);
						var q = new Element('div').addClassName('center-cell');
						var question = new Element('a').addClassName('button').update(pidquestion[pidquestionct].question);
						var pidqid= pidquestion[pidquestionct].qid;
						q.insert(question);
						
						q.observe('click',function(){
							selectedTopSupportQue=pidqid;
							buildSupport(selectedTopSupportQue);
						});
						Event.observe(question, 'mouseover', function(event) {
							question.addClassName('onhover');
						});
						Event.observe(question, 'mouseout', function(event) {
							question.removeClassName('onhover');
						});
						pidquestionct+=1;
				}
			
			
			}
			else{
			
			// question
			var q = new Element('div').addClassName('center-cell');
			var question = new Element('a').addClassName('button').update(item.question);
			q.insert(question);
			
			q.observe('click',function(){
				selectedTopSupportQue=item.id;
				buildSupport(selectedTopSupportQue);
			});
			Event.observe(question, 'mouseover', function(event) {
				question.addClassName('onhover');
			});
			Event.observe(question, 'mouseout', function(event) {
				question.removeClassName('onhover');
			});
			
			}
			
			// more button
			var r = new Element('div').addClassName('right-cell');
			if (counter == tslen) {
				var arrow = new Element('img', {src: 'images/common/rightarrow-block.gif', width: '11', height: '13', border: '0', alt: 'More'})
				//var moreButton = new Element('span').insert("<br><br>"+ref.Home.topsupport.morelabel).insert(arrow).addClassName('more button');
				var moreButton = new Element('span').insert(ref.Home.topsupport.morelabel).insert(arrow).addClassName('more button');
				Event.observe(moreButton, 'click', function(){
					selectedTopSupportQue="";
					buildSupport();
				});
				r.insert(moreButton);
			}
			
			topsupportList.insert(new Element('div').addClassName('container').insert(i).insert(q).insert(r));

			counter++;
		});
		if(selectedCountry=='us' && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')==true)
		{
			
			var newhdiv = new Element('div', {align: 'center'}).addClassName('left-cell');
			newhdiv.insert(new Element('img', {src: 'images/common/exclaim.gif', width: '15', height: '12', border: '0', alt: '!'}));
			var newhq = new Element('div').addClassName('center-cell');
			var newhquestion = new Element('a').addClassName('button').update('How do I reset my Digital Copy Manager account password?');
			newhq.insert(newhquestion);
			
			newhq.observe('click',function(){
				selectedTopSupportQue='Reset_DCM_Password';
				selectedFormat='wmv';
				buildSupport('Reset_DCM_Password');
			});
			Event.observe(newhquestion, 'mouseover', function(event) {
				newhquestion.addClassName('onhover');
			});
			Event.observe(newhquestion, 'mouseout', function(event) {
				newhquestion.removeClassName('onhover');
			});
			topsupportList.insert(new Element('div').addClassName('container').insert(newhdiv).insert(newhq));
			
		}
		middleDiv.insert(topsupportList);

		$('main-content').update(homeDiv);
		//consumer notice update for SPEED RACER(Blu-Ray)
		/*var jap1 ="7E11B4D1-C902-4e03-AB55-4F80A19FBDE8"
		var jap2 ="FAAED300-93D0-4063-AF0E-F5AB90A5E46E";
		
		if((selectedTitle=='06126FE7-7572-46C6-ADE1-454F0EE39444' && selectedCountry =='us') || (selectedTitle=='06126FE7-7572-46C6-ADE1-454F0EE39444' && selectedCountry =='ca'))
		{
			var consumerNotice = new Element('div').addClassName('consumernotice-content');
			consumerNotice.insert("CONSUMER NOTICE:  During the period from 3/17/09 to 4/30/09, the iTunes version of the Digital Copy for SPEED RACER was unavailable due to an inadvertent error.  The error has been corrected and you may redeem your Digital Copy with the unused authorization code enclosed with your Blu-ray disc purchase.  Should you have difficulties redeeming your iTunes Digital Copy, click the \"Digital Copy Support for iTunes\" link to the right.  If necessary, further assistance may be requested from Digital Copy Support by clicking <a href=\"http://digitalcopy.warnerbros.com/support/speedracer_form.aspx\">here</a>.");
			//consumerNotice.insert(Data.consumernotice[selectedCountry].mssg);
			$('main-content').insert('<br>').insert(consumerNotice);
		}
		else if((selectedTitle.toLowerCase()==jap1.toLowerCase() && selectedCountry =='jp') || (selectedTitle.toLowerCase()==jap2.toLowerCase() && selectedCountry =='jp'))
		{
		$('updates-list').update('<a href="http://www.wbdigitalcopy.com/hp6/jp">&#12480;&#12454;&#12531;&#12525;&#12540;&#12489;&#12399;&#12371;&#12385;&#12425;&#12363;&#12425;: www.wbdigitalcopy.com/hp6/jp</a>');	
		}
		*/
			
		if(selectedSource .include('DC'))
			buildLanguageSelector(Home);
		else
			buildLanguageSelector();
		
		//updates for Fred Claus and Speed Racer
		var speedRacer =  '06126FE7-7572-46C6-ADE1-454F0EE39444';
		var fredClaus = 'FREDCLAUS_TECHNICOLOR';
		var darkKnightES_BD = "155FBED6-CBF8-4e71-82A8-DD4BF7928F80";
		var wonderWoman_SE = "29637065-1909-42a1-A59C-BE8AD19BA255";
		var benjaminButton_BD = "E266F693-78D5-43e3-BAE5-50F23E824B45";
		var batman20Anniversary_BD = "076E63B3-0685-4B68-9DD0-66B4504DB1C6-Batman-20th-Anniversary";
		
		
		//if(selectedTitle.toLowerCase() == speedRacer.toLowerCase() && selectedCountry != 'mx')
			//buildUpdatesForSpeedRacer();	
		if(selectedTitle.toLowerCase() == fredClaus.toLowerCase())
			buildUpdatesForFredClaus();	
		if(selectedTitle.toLowerCase() == darkKnightES_BD.toLowerCase())
			buildUpdatesForDarkKnight();	
		if(selectedTitle.toLowerCase() == wonderWoman_SE.toLowerCase())
			buildUpdatesForWonderWoman();
		if(selectedTitle.toLowerCase() == benjaminButton_BD.toLowerCase())
			buildUpdatesForBenjaminButton();
		//if(selectedTitle.toLowerCase() == batman20Anniversary_BD.toLowerCase())
			//buildUpdatesForBatman20Ann();
		
		
		
		
		clearCountrySelector();
		buildHeader();
		buildFooter();
		buildStoredInfo();
		buildCopyright();
		buildSectionTitle(Home);
		if($('home-button') != null)
			$('home-button').addClassName('sectionselect');
		
		
		
		
		if(discInfo == null)
		{discInfo = gatherSingleDiscInfo(selectedTitle);
		}
		
		
		/*------------------------------------------------Emergency Consumer Notice Area ----------------*/
		//alert(getspecificdiscInfo('format','iTunes',selectedTitle));
		
		/*if(  getspecificdiscInfo('format','iTunes',selectedTitle) == 'iTunes')
		{
			
			var consumerNotice = new Element('div').addClassName('consumernotice-content_itunes');
			consumerNotice.insert("Service Alert: If you are trying to redeem your Digital Copy at the iTunes Store, it is currently busy, please try again later. We apologize for the inconvenience.");
			//consumerNotice.insert(Data.consumernotice[selectedCountry].mssg);
			$('main-content').insert('<br>').insert(consumerNotice);
		}*/
		
		
		
		
		
		
		
		
		/*------------------------------------------------ End Emergency Consumer Notice ----------------*/
		//else{alert(discInfo);}
		//alert(getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle));
		//alert(getspecificdiscInfo('source','DCON',selectedTitle));
		//If the selected offer has a redemption site URL provided and is DCON show url
		if(getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle) != '' && getspecificdiscInfo('source','DCON',selectedTitle) =='DCON' )
		{
			var redemptionURLNotice = new Element('div').addClassName('redemptionnotice-content');
			var redemptionnoticeURL = getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle);
			redemptionURLNotice.insert(Data.redeemlabel[selectedLang].label + ": <a href=\" "+ redemptionnoticeURL+" \" target=\"blank\">"+ redemptionnoticeURL+"</a>");
			$('main-content').insert('<br>').insert(redemptionURLNotice);
		}
		
		
		//If the selected offer has an expiration date show it
	    		
	    //alert(datecountryFormat(getspecificdiscInfo('expire','date',selectedTitle) , selectedCountry));
		//alert(getspecificdiscInfo('expire','date',selectedTitle));
		//alert(getspecificdiscInfo('expire','date',selectedTitle));
		if(datecountryFormat(getspecificdiscInfo('expire','date',selectedTitle),selectedCountry)!= '')
		{ // display expired date under nav menu
			$('expire-info').update('');			
			var discexpireDate = getspecificdiscInfo('expire','date',selectedTitle);
			$('expire-info').insert(Data.expirelabel[selectedLang].label+ "<br/>"+ discexpireDate);
		}
		
		
		
		
	}
}

/**
 * This method sends the info to omniture
 * @param {} selectedSection
 */
function sendInfoToOmniture(selectedSection)
{
	
	if(userID == null)
	{
		userID = getUserID();
	}
	//send info to omniture
	if(selectedSection == 'LandingPage')
	{
		var omniVars = new Object();
		clearOmnitureParams(omniVars);
		omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
		omniVars.prop1 = selectedCountry;
		omniVars.channel =  "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;;
		doOmnitureTrackData(omniVars);
	}
	else
	{
		var omniVars = new Object();
		clearOmnitureParams(omniVars);
		var formatOmniture = '';
		omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
		omniVars.channel =  "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;;
		omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
		omniVars.prop5 = userID; 
		if(selectedTitle != null || selectedTitle!= undefined || selectedTitle!= false)
		{
			omniVars.prop3  = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle(selectedTitle)+": "+getDiscEdition(selectedTitle);
			omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource(selectedTitle);
			if(getDiscFormat(selectedTitle,'WMV') != '')
			{
				if(getDiscFormat(selectedTitle,'iTunes') != '')
				{
					formatOmniture = getDiscFormat(selectedTitle,'WMV')+" and "+getDiscFormat(selectedTitle,'iTunes');
				}
				else
				{
					formatOmniture = getDiscFormat(selectedTitle,'WMV');
				}
			}
			else
			{
				if(getDiscFormat(selectedTitle,'iTunes') != '')
				{
					formatOmniture = getDiscFormat(selectedTitle,'iTunes');
				}
			}
		}
		omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+formatOmniture;
		doOmnitureTrackData(omniVars);
	}
}

/**
*	Build the Getting Started section
*/
function buildGettingStarted() {
	
	log('buildGettingStarted selectedTitle: '+selectedTitle);
	
	if (GettingStarted.language == undefined || selectedLang != GettingStarted.language) {
		loadGettingStarted();
		buildLanguageSelector(GettingStarted);
	} else {
		
		log('selectedFormat: '+selectedFormat);
		selectedSection = "GettingStarted";
		positionMainContent(selectedSection);
		removeHeaderHighlight();
		if(document.location.hash.include("inapp"))
			buildHash("GetStarted&discid="+selectedTitle+"&country="+selectedCountry+"&inapp=true&code="+authorizationCode+"&lang="+selectedLang);
		else buildHash("GetStarted&discid="+selectedTitle+"&country="+selectedCountry);
		
		sendInfoToOmniture(selectedSection);
		
		// create getting started container
		var gettingStartedDiv = new Element('div', {id: 'gettingstarted-content',name:'gettingstarted-content'});
		//build div for tabs
		var tabDiv = new Element('div',{id:'getting-started'});
		var currentFormatDiv = new Element('div',{id:'currentformat-tab'});
		//var curSelTab = new Element('div',{id:'cursel-tab'});
		var changeFormatDiv = new Element('div',{id:'changeformat-tab',align:'center'});
	//	currentFormatDiv.insert(curSelTab);
		tabDiv.insert(currentFormatDiv);
		tabDiv.insert(changeFormatDiv);
		
		var wmvDiv = new Element('div',{id:'wmvdiv',width:'64px',height:'64px'});
		var itunesDiv = new Element('div',{id:'itunesdiv',width:'64px',height:'64px'});
		var wmvTab = new Element('img',{src: 'images/common/logo_wmp.png',id:'wmv',width:'64px', height:'64px'}).addClassName('tab button');
		var itunesTab =new Element('img',{src: 'images/common/logo_itunes.png',id:'itunes',width:'64px', height:'64px'}).addClassName('tab button');
		
		
		wmvDiv.update(wmvTab);
		itunesDiv.update(itunesTab);
		//tabDiv.insert(itunesDiv).insert(wmvDiv);
		gettingStartedDiv.insert(tabDiv);
		
		var lineDiv = new Element('div',{id:'line-tab'});
		//3/30/2010
		/*
		changeFormatDiv.insert("Change your Platform");
		if(BrowserDetect.browser == "Explorer")
		{
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {   
				changeFormatDiv.insert(itunesDiv).insert(wmvDiv);
				Event.observe(wmvTab, 'load', function(event){
					fixPNG(wmvTab);
				});
				Event.observe(itunesTab, 'load', function(event){
					fixPNG(itunesTab);
				});
				
		    }
			else
				changeFormatDiv.insert(itunesTab).insert(wmvTab);
		}
		else
		changeFormatDiv.insert(itunesTab).insert(wmvTab);
		*/
		gettingStartedDiv.insert(lineDiv);

		// build middle div containg the getting started steps
		var middleDiv = new Element('div', {id: 'middle'} );
		gettingStartedDiv.insert(middleDiv)	
		
		
		
		// build faq-section div wmv
		var wmvFaqDiv = new Element('div', {id: 'wmv-section'}).addClassName('hidden');
		var wmvHeader = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var title = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		wmvFaqDiv.insert(wmvHeader);
		wmvFaqDiv.insert(title);
		wmvFaqDiv.insert("<br />");
		middleDiv.insert(wmvFaqDiv);
		
		// build faq-section div itunes
		var itunesFaqDiv = new Element('div', {id: 'itunes-section'}).addClassName('hidden');
		var itunesHeader = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var title = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		itunesFaqDiv.insert(itunesHeader);
		itunesFaqDiv.insert(title);
		itunesFaqDiv.insert("<br />");
		middleDiv.insert(itunesFaqDiv);
		
		// build faq-section div dcmanager
		var dcManagerFaqDiv = new Element('div', {id: 'dcmanager-section'}).addClassName('hidden');
		var dcManagerHeader = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var title = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		dcManagerFaqDiv.insert(dcManagerHeader);
		dcManagerFaqDiv.insert(title);
		dcManagerFaqDiv.insert("<br />");
		middleDiv.insert(dcManagerFaqDiv);
		
		// build faq-section div dcmobile
		var dcMobileFaqDiv = new Element('div', {id: 'dcmobile-section'}).addClassName('hidden');
		var dcMobileHeader = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var title = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		dcMobileFaqDiv.insert(dcMobileHeader);
		dcMobileFaqDiv.insert(title);
		dcMobileFaqDiv.insert("<br />");
		middleDiv.insert(dcMobileFaqDiv);
		
		/*
		// build faq-section div for PID
		var wmvFaqDivPID = new Element('div', {id: 'wmv-section'}).addClassName('hidden');
		var wmvHeaderPID = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var optionHeaderPID = new Element('div', {id: 'top',align:'center'}).addClassName('optionheader');
		var titlePID = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		wmvFaqDivPID.insert(wmvHeaderPID);
		wmvFaqDivPID.insert(optionHeaderPID);
		wmvFaqDivPID.insert(titlePID);
		wmvFaqDivPID.insert("<br />");
		//middleDiv.insert(wmvFaqDivPID);
		
		// build faq-section div for HUB
		var wmvFaqDivHUB = new Element('div', {id: 'wmv-section'}).addClassName('hidden');
		var wmvHeaderHUB = new Element('div', {id: 'top',align:'center'}).addClassName('header');
		var optionHeaderHUB = new Element('div', {id: 'top',align:'center'}).addClassName('optionheader');
		var titleHUB = new Element('div',{align:'center'}).addClassName('title').update(getDiscTitle(selectedTitle));
		wmvFaqDivHUB.insert(wmvHeaderHUB);
		wmvFaqDivHUB.insert(optionHeaderHUB);
		wmvFaqDivHUB.insert(titleHUB);
		wmvFaqDivHUB.insert("<br />");
		//middleDiv.insert(wmvFaqDivHUB);
		*/
		
		
		
		var showImageWMV = true;
		var showImageITunes = true;
		var showImagedcManager = true;
		var showImagedcMobile = true;
		//testing remove below ++++++++++++++
		if('35921231-123F-4ee5-AEF3-99D330589458' == selectedTitle)
		{
			//if( getPIDHUBCountry(selectedTitle, selectedCountry,'HUB'))
			//	alert("doing what its supposed to do");
			//alert("country="+getPIDCountry(selectedTitle, selectedCountry));
			//getPIDHUBCountry(selectedTitle, selectedCountry);
		}
		//testing remove above+++++++++++++++++++
			
		var countryofPID= getPIDHUBCountry(selectedTitle, selectedCountry,'PID');
		var countryofHUB= getPIDHUBCountry(selectedTitle, selectedCountry,'HUB');
		
		if(discInfo == null)
		discInfo = gatherSingleDiscInfo(selectedTitle);	
		//alert(getspecificdiscInfo('format','DCMANAGERREWA',selectedTitle));
		var instructionsredemptionURL = "";
		if(getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle) != '' && getspecificdiscInfo('source','DCON',selectedTitle) =='DCON' )
		{
			var instructionsredemptionURL = getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle);
		}
		
		GettingStarted.itemsArr.each( function(s) {
			if(s.source == getDiscSource(selectedTitle))
			{ var stepCnt = 0;
			  var stepCnt2=0;
				s.items.each(function(item){
					/*
					 * -----------------------------------------------------------------------------WMV------------------------------------------------
					 */
					if(item.format.toLowerCase() == getspecificdiscInfo('format','WMV',selectedTitle).toLowerCase() )
					{  /****
						 * WMV: Pid and Hub related information displayed (satisfy special case)
						 */
						if( ((item.collection == "PID") && countryofPID &&  countryofHUB) || ((item.collection == "HUB") && countryofPID &&  countryofHUB) )
						{  //alert("both PID or HUB");
							
							if((item.collection == "PID"))
							{
							var stepCnt = 0;
							item.steps.each(function(step){
								stepCnt = stepCnt+1;
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
										
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImageWMV == true)
								{
									if(s.source == 'DCOD')
									{
										showImageWMV=false;
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										div.insert(thumbDiv);
										div.insert(stepDiv);
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
									}
									else if(s.source == 'DCON')
									{
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
										wmvFaqDiv.insert(thumbDiv);
										
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
										showImageWMV=false;
									}	
								}else {
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
								}
							})
							wmvHeader.insert(item.header);
							middleDiv.insert(wmvFaqDiv);
							
							}//end (item.collection == "PID")
						
							 if((item.collection == "HUB"))
							{
							var stepCnt = 0;
							var headerHUB =new Element('div', {id: 'top',align:'center'}).addClassName('header')
							wmvFaqDiv.insert(headerHUB).insert("<br/>");
							
							item.steps.each(function(step){
								stepCnt = stepCnt+1;
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
										
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImageWMV == true)
								{
									if(s.source == 'DCOD')
									{
										showImageWMV=false;
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										div.insert(thumbDiv);
										div.insert(stepDiv);
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
									}
									else if(s.source == 'DCON')
									{
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
										wmvFaqDiv.insert(thumbDiv);
										
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
										showImageWMV=false;
									}	
								}else {
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
								}
							})
							headerHUB.update(item.header);
							}//end (item.collection == "HUB")
							
						} //end WMV special case
						/****
						 * WMV: Pid related information displayed
						 */
					//if(item.collection == getDiscCollection(selectedTitle,'PID'))
					//	else if((item.collection == "PID") && getPIDHUBCountry(selectedTitle, selectedCountry,'PID') )
						else if((item.collection == "PID") && countryofPID )
						{ // alert(" WMV   PID"); 
						var stepCnt = 0;
						item.steps.each(function(step){
							stepCnt = stepCnt+1;
							var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
							var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
									
							var div = new Element('div').addClassName('step');
							div.insert(label);
							div.insert(stepDiv);
							if(showImageWMV == true)
							{
								if(s.source == 'DCOD')
								{
									showImageWMV=false;
									var label = new Element('div').addClassName('label').update(step.label);
									var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
									var div = new Element('div').addClassName('step');
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'right'}).update(thumb);
									div.insert(label);
									div.insert(thumbDiv);
									div.insert(stepDiv);
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
								}
								else if(s.source == 'DCON')
								{
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'center'}).update(thumb);
									wmvFaqDiv.insert(thumbDiv);
									
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
									showImageWMV=false;
								}	
							}else {
								wmvFaqDiv.insert(div);
								wmvFaqDiv.insert("<br />");
							}
						})
						wmvHeader.update(item.header);
					}
						/****
						 * WMV: HUB related information displayed
						 */
					/*	else if((item.collection == "HUB") && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB') )
						{ 
						var stepCnt = 0;
						item.steps.each(function(step){
							stepCnt = stepCnt+1;
							var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
							var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
									
							var div = new Element('div').addClassName('step');
							div.insert(label);
							div.insert(stepDiv);
							if(showImageWMV == true)
							{
								if(s.source == 'DCOD')
								{
									showImageWMV=false;
									var label = new Element('div').addClassName('label').update(step.label);
									var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
									var div = new Element('div').addClassName('step');
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'right'}).update(thumb);
									div.insert(label);
									div.insert(thumbDiv);
									div.insert(stepDiv);
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
								}
								else if(s.source == 'DCON')
								{
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'center'}).update(thumb);
									wmvFaqDiv.insert(thumbDiv);
									
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
									showImageWMV=false;
								}	
							}else {
								wmvFaqDiv.insert(div);
								wmvFaqDiv.insert("<br />");
							}
						})
						wmvHeader.update(item.header);
					}*/
							/***
							 * WMV: Neither PID or HUB related information displayed here
							 */
						//else if( ((item.collection == undefined && getDiscCollection(selectedTitle,'PID') == '' && getDiscCollection(selectedTitle,'HUB') == '' )) || (item.collection == undefined && getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==false && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')==false))
						else if( item.collection == undefined &&  countryofPID ==false  ) 
						{  //alert("WMV neither PID or HUB");
							
							 stepCnt=0;
							if(stepCnt <1){
								
								item.steps.each(function(step){
								stepCnt = stepCnt+1;
								
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								
								//alert(step.instruction + stepCnt);
								if(instructionsredemptionURL != '' && stepCnt ==1)
								{	var tmp_instruct = step.instruction.split('w');
									tmp2_instruct = tmp_instruct[0] + '<a href=\''+instructionsredemptionURL+'\' target=\'_blank\'>'+instructionsredemptionURL+'</a>';
									var stepDiv = new Element('span',{width:'50'}).update(tmp2_instruct).addClassName("stepDiv");
								}						
								else
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
										
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImageWMV == true)
								{
									if(s.source == 'DCOD')
									{
										showImageWMV=false;
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										div.insert(thumbDiv);
										div.insert(stepDiv);
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
									}
									else if(s.source == 'DCON')
									{
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
										wmvFaqDiv.insert(thumbDiv);
										
										wmvFaqDiv.insert(div);
										wmvFaqDiv.insert("<br />");
										showImageWMV=false;
									}	
								}else {
									wmvFaqDiv.insert(div);
									wmvFaqDiv.insert("<br />");
								}
							
							})
							}
							wmvHeader.update(item.header);
					
						}
					}
					/*
					 * -----------------------------------------------------------------------------ITUNES------------------------------------------------
					 */
					if(item.format.toLowerCase() == getspecificdiscInfo('format','iTunes',selectedTitle).toLowerCase())
					{  
						/****
						 * Itunes: Pid and Hub related information displayed (satisfy special case)
						 */
						if( ((item.collection == "PID") && countryofPID &&  countryofHUB) || ((item.collection == "HUB") && countryofPID &&  countryofHUB) )
						{ //alert("Itunes PID & HUB");
							if(item.collection == "PID")
							{
							item.steps.each(function(step){
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImageITunes == true)
								{
									if(s.source == 'DCOD')
									{
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										div.insert(thumbDiv);
										div.insert(stepDiv);
										itunesFaqDiv.insert(div);
										itunesFaqDiv.insert("<br />");
										showImageITunes=false;
									}
									else if(s.source == 'DCON')
									{
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
										itunesFaqDiv.insert(thumbDiv);
										
										itunesFaqDiv.insert(div);
										itunesFaqDiv.insert("<br />");
										showImageITunes=false;
									}	
								}else{
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
								}
							})
							itunesHeader.update(item.header);
						}//end PID
							if(item.collection == "HUB")
							{   var headerHUBitunes =new Element('div', {id: 'top',align:'center'}).addClassName('header')
								itunesFaqDiv.insert(headerHUBitunes).insert("<br/>"); 
								
								item.steps.each(function(step){
									var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
									var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
									var div = new Element('div').addClassName('step');
									div.insert(label);
									div.insert(stepDiv);
									if(showImageITunes == true)
									{
										if(s.source == 'DCOD')
										{
											var label = new Element('div').addClassName('label').update(step.label);
											var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
											var div = new Element('div').addClassName('step');
											var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
											var thumbDiv = new Element('div',{align:'right'}).update(thumb);
											div.insert(label);
											div.insert(thumbDiv);
											div.insert(stepDiv);
											itunesFaqDiv.insert(div);
											itunesFaqDiv.insert("<br />");
											showImageITunes=false;
										}
										else if(s.source == 'DCON')
										{
											var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
											var thumbDiv = new Element('div',{align:'center'}).update(thumb);
											itunesFaqDiv.insert(thumbDiv);
											
											itunesFaqDiv.insert(div);
											itunesFaqDiv.insert("<br />");
											showImageITunes=false;
										}	
									}else{
										itunesFaqDiv.insert(div);
										itunesFaqDiv.insert("<br />");
									}
								})
								headerHUBitunes.insert(item.header);
								
								
							}	
						}
						
						/***
						 * Itunes: PID information displayed
						 */
						//else if(item.collection == "PID" && getPIDHUBCountry(selectedTitle, selectedCountry,'PID'))
						else if(item.collection == "PID" && countryofPID ==true)
						{  //alert("Itunes PID");
							item.steps.each(function(step){
							var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
							var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
							var div = new Element('div').addClassName('step');
							div.insert(label);
							div.insert(stepDiv);
							if(showImageITunes == true)
							{
								if(s.source == 'DCOD')
								{
									var label = new Element('div').addClassName('label').update(step.label);
									var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
									var div = new Element('div').addClassName('step');
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'right'}).update(thumb);
									div.insert(label);
									div.insert(thumbDiv);
									div.insert(stepDiv);
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
									showImageITunes=false;
								}
								else if(s.source == 'DCON')
								{
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'center'}).update(thumb);
									itunesFaqDiv.insert(thumbDiv);
									
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
									showImageITunes=false;
								}	
							}else{
								itunesFaqDiv.insert(div);
								itunesFaqDiv.insert("<br />");
							}
						})
						itunesHeader.update(item.header);
					}
						/***
						 * Itunes: HUB information displayed
						 */
						/*else if(item.collection == "HUB" && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB'))
						{  
							item.steps.each(function(step){
							var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
							var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
							var div = new Element('div').addClassName('step');
							div.insert(label);
							div.insert(stepDiv);
							if(showImageITunes == true)
							{
								if(s.source == 'DCOD')
								{
									var label = new Element('div').addClassName('label').update(step.label);
									var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
									var div = new Element('div').addClassName('step');
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'right'}).update(thumb);
									div.insert(label);
									div.insert(thumbDiv);
									div.insert(stepDiv);
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
									showImageITunes=false;
								}
								else if(s.source == 'DCON')
								{
									var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
									var thumbDiv = new Element('div',{align:'center'}).update(thumb);
									itunesFaqDiv.insert(thumbDiv);
									
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
									showImageITunes=false;
								}	
							}else{
								itunesFaqDiv.insert(div);
								itunesFaqDiv.insert("<br />");
							}
						})
						itunesHeader.update(item.header);
					}*/
						/***
						 * Itunes: Neither PID or HUB related so display default
						 */
						//else if((item.collection == undefined && getDiscCollection(selectedTitle,'PID') == '' && getDiscCollection(selectedTitle,'HUB') == '') || (item.collection == undefined && getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==false && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')==false))
						else if( item.collection == undefined && countryofPID ==false)
						{   //alert(" Itunes neither PID or HUB");
							
						if(stepCnt2 <1){
							
							item.steps.each(function(step){
								stepCnt2 = stepCnt2+1;
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								
								if(instructionsredemptionURL != '' && stepCnt2 ==1)
								{var tmp_instruct = step.instruction.split('w');
								tmp2_instruct = tmp_instruct[0] + '<a href=\''+instructionsredemptionURL+'\' target=\'_blank\'>'+instructionsredemptionURL+'</a>';
								var stepDiv = new Element('span',{width:'50'}).update(tmp2_instruct).addClassName("stepDiv");
								}						
								else
								{var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");}
								
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImageITunes == true)
								{
									if(s.source == 'DCOD')
									{
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										div.insert(thumbDiv);
										div.insert(stepDiv);
										itunesFaqDiv.insert(div);
										itunesFaqDiv.insert("<br />");
										showImageITunes=false;
									}
									else if(s.source == 'DCON')
									{
										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
										itunesFaqDiv.insert(thumbDiv);
										
										itunesFaqDiv.insert(div);
										itunesFaqDiv.insert("<br />");
										showImageITunes=false;
									}	
								}else{
									itunesFaqDiv.insert(div);
									itunesFaqDiv.insert("<br />");
								}
							})
						}	
							itunesHeader.update(item.header);
						}
					}
					/*
					 * -----------------------------------------------------------------------------DCMANAGER------------------------------------------------
					 */
					if(item.format.toLowerCase() == getspecificdiscInfo('format','DCMANAGER',selectedTitle).toLowerCase())
					{  
						if( item.collection == undefined)
						{  //alert(" Itunes neither PID or HUB");
							
						//if(stepCnt2 <1){
						//	stepCnt2 = stepCnt2+1;
							item.steps.each(function(step){
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImagedcManager == true)
								{
									if(s.source == 'DCOD')
									{
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										//var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										//var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										//div.insert(thumbDiv);
										div.insert(stepDiv);
										dcManagerFaqDiv.insert(div);
										dcManagerFaqDiv.insert("<br />");
										showImagedcManager=false;
									}
									else if(s.source == 'DCON')
									{
//										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
//										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
//										dcManagerFaqDiv.insert(thumbDiv);
										
										dcManagerFaqDiv.insert(div);
										dcManagerFaqDiv.insert("<br />");
										showImagedcManager=false;
									}	
								}else{
									dcManagerFaqDiv.insert(div);
									dcManagerFaqDiv.insert("<br />");
								}
							})
						//}	
							dcManagerHeader.update(item.header);
						}
					}
					/*
					 * -----------------------------------------------------------------------------DCMOBILE------------------------------------------------
					 */
					if(item.format.toLowerCase() == getspecificdiscInfo('format','DCMMOBILE',selectedTitle).toLowerCase())
					{
						if( item.collection == undefined )
						{  //alert(" Itunes neither PID or HUB");
							
						//if(stepCnt2 <1){
						//	stepCnt2 = stepCnt2+1;
							item.steps.each(function(step){
								var label = new Element('div',{width:'5'}).addClassName('label').update(step.label);
								var stepDiv = new Element('span',{width:'50'}).update(step.instruction).addClassName("stepDiv");
								var div = new Element('div').addClassName('step');
								div.insert(label);
								div.insert(stepDiv);
								if(showImagedcMobile == true)
								{
									if(s.source == 'DCOD')
									{
										var label = new Element('div').addClassName('label').update(step.label);
										var stepDiv = new Element('span').update(step.instruction).addClassName("stepDiv");
										var div = new Element('div').addClassName('step');
										//var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'right', border: '0'}).addClassName('screenshot');
										//var thumbDiv = new Element('div',{align:'right'}).update(thumb);
										div.insert(label);
										//div.insert(thumbDiv);
										div.insert(stepDiv);
										dcMobileFaqDiv.insert(div);
										dcMobileFaqDiv.insert("<br />");
										showImagedcMobile=false;
									}
									else if(s.source == 'DCON')
									{
//										var thumb = new Element('img', {src: step.image, alt: step.label,  width: '196', height:'120', align:'center', border: '0'}).addClassName('screenshot');
//										var thumbDiv = new Element('div',{align:'center'}).update(thumb);
//										dcMobileFaqDiv.insert(thumbDiv);
										
										dcMobileFaqDiv.insert(div);
										dcMobileFaqDiv.insert("<br />");
										showImagedcMobile=false;
									}	
								}else{
									dcMobileFaqDiv.insert(div);
									dcMobileFaqDiv.insert("<br />");
								}
							})
						//}	
							dcMobileHeader.update(item.header);
						}
					}
					//end format checking
				});
			}
		});
		
		middleDiv.insert(wmvFaqDiv);
		middleDiv.insert(itunesFaqDiv);
		wmvFaqDiv.removeClassName('hidden');
		wmvTab.setStyle({disabled:true}).addClassName('disabled');
		
		$('main-content').update(gettingStartedDiv);
		
		log('showImageWMV '+showImageWMV);
		
		if(selectedFormat != "")
		{
			
			if(getspecificdiscInfo('format',selectedFormat,selectedTitle).toLowerCase() != selectedFormat)
			{// means in application they have changed there disc selection to a new one with new formats
			 // the format var at this point has the old format value, so check if current selected title has the old format
			 // if not then set a default for the current disc.
				if(getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase() == 'wmv')
				{	buildQuestionArea('wmv','gettingstarted');}
				else if(getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase() == 'itunes')
				{	buildQuestionArea('itunes','gettingstarted');}
				else if(getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase() == 'dcmanager')
				{	buildQuestionArea('dcmanager','gettingstarted');}
				else if(getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase() == 'dcmobile')
				{	buildQuestionArea('dcmobile','gettingstarted');}
			}
			else if(selectedFormat.toLowerCase()== "wmv")
			{   
				buildQuestionArea('wmv','gettingstarted');	
			}
			else if(selectedFormat.toLowerCase()== "itunes")
			{
				buildQuestionArea('itunes','gettingstarted');
			}
			else if(selectedFormat.toLowerCase()== "dcmanager")
			{
				buildQuestionArea('dcmanager','gettingstarted');
			}
			else if(selectedFormat.toLowerCase()== "dcmobile")
			{
				buildQuestionArea('dcmobile','gettingstarted');
			}
			/* 
			 if(selectedFormat.toLowerCase()=="wmv")
			{
				showItunesTab(showImageITunes);
				showWMVTab(showImageWMV);
			}
			else if(selectedFormat.toLowerCase()=="itunes")
			{
				showWMVTab(showImageWMV);
				showItunesTab(showImageITunes);
			}
			*/	
		}
		else
		{		
			setFormat('wmv');
			buildQuestionArea('wmv','gettingstarted');
			showItunesTab(showImageITunes);
			showWMVTab(showImageWMV);
		}
		
		/*
		$('wmv').observe('click',function(){
			onChangeWMV();
			
		});
		$('itunes').observe('click', function(){
			onChangeITunes();
		});
		
		if($('wmvdiv') != null)
		{
			$('wmvdiv').observe('click',function(){
				onChangeWMV();
				
			});
		}
		if($('itunesDiv') != null)
		{	
			$('itunesDiv').observe('click', function(){
				onChangeITunes();
			});
		}
		
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(wmvTab);fixPNG(itunesTab);

	    }
		*/
		
		buildLanguageSelector(GettingStarted);
		clearCountrySelector();
		clearUpdates();
		buildStoredInfo();
		buildHeader();
		buildFooter();
		buildSectionTitle(GettingStarted);
		if($('gettingstarted-button') != null)
			$('gettingstarted-button').addClassName('sectionselect');
		
		if(datecountryFormat(getspecificdiscInfo('expire','date',selectedTitle),selectedCountry)!= '')
		{ // display expired date under nav menu
			$('expire-info').update('');			
			var discexpireDate = getspecificdiscInfo('expire','date',selectedTitle);
			$('expire-info').insert("Digital Copy Offer Expires:<br/>"+ discexpireDate);
		}
		
		
		
		
		
		
		
	}
}

function onChangeWMV()
{
	selectedFormat = 'wmv';
	setFormat('wmv');
	
	$('wmv-section').removeClassName('hidden');
	if(!$('itunes-section').hasClassName('hidden'))
		$('itunes-section').addClassName('hidden');
	if(!$('dcmobile-section').hasClassName('hidden'))
		$('dcmobile-section').addClassName('hidden');
	if(!$('dcmanager-section').hasClassName('hidden'))
		$('dcmanager-section').addClassName('hidden');
	
	/*
	selectedFormat = 'wmv';
	setFormat('wmv');
	
	$('wmv').setStyle({disabled:true}).addClassName('disabled');
	$('itunes').setStyle({disabled:false}).removeClassName('disabled'); 
	$('wmv-section').removeClassName('hidden');
	if(!$('itunes-section').hasClassName('hidden'))
		$('itunes-section').addClassName('hidden');
	$('currentformat-tab').update('Your current platform');
	var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
	Event.observe(wmp, 'load', function(event){
		fixPNG(wmp);
	});
	$('currentformat-tab').insert(wmp);

	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(wmp);
    }
*/

}

function onChangeITunes()
{
	selectedFormat = 'itunes';
	setFormat('itunes');
	
	$('itunes-section').removeClassName('hidden');
	if(!$('wmv-section').hasClassName('hidden'))
		$('wmv-section').addClassName('hidden');
	if(!$('dcmobile-section').hasClassName('hidden'))
		$('dcmobile-section').addClassName('hidden');
	if(!$('dcmanager-section').hasClassName('hidden'))
		$('dcmanager-section').addClassName('hidden');
	/*
	selectedFormat = 'itunes';
	setFormat('itunes');
	
	$('itunes').setStyle({disabled:true}).addClassName('disabled');
	$('wmv').setStyle({disabled:false}).removeClassName('disabled');
	$('itunes-section').removeClassName('hidden');
	if(!$('wmv-section').hasClassName('hidden'))
		$('wmv-section').addClassName('hidden');
	$('currentformat-tab').update('Your current platform');
	var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
	Event.observe(itun, 'load', function(event){
		fixPNG(itun);
	});
	$('currentformat-tab').insert(itun);
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(itun);
    }
    */
}

function onChangedcManager()
{
	selectedFormat = 'dcmanager';
	setFormat('dcmanager');
	
	$('dcmanager-section').removeClassName('hidden');
	
	if(!$('wmv-section').hasClassName('hidden'))
		$('wmv-section').addClassName('hidden');
	if(!$('itunes-section').hasClassName('hidden'))
		$('itunes-section').addClassName('hidden');
	if(!$('dcmobile-section').hasClassName('hidden'))
		$('dcmobile-section').addClassName('hidden');
	
}

function onChangedcMobile()
{
	selectedFormat = 'dcmobile';
	setFormat('dcmobile');
	
	$('dcmobile-section').removeClassName('hidden');
	
	if(!$('wmv-section').hasClassName('hidden'))
		$('wmv-section').addClassName('hidden');
	if(!$('itunes-section').hasClassName('hidden'))
		$('itunes-section').addClassName('hidden');
	if(!$('dcmanager-section').hasClassName('hidden'))
		$('dcmanager-section').addClassName('hidden');
	
	
}


/**
 * This method shows the iTunes tab.
 * @param showImageITunes
 * @return
 */
function showItunesTab(showImageITunes)
{   
	if(showImageITunes == true)
	{
		$('itunes').hide();
	/*	if($('itunesdiv')!=null){
			$('itunesdiv').hide();
			$('wmvdiv').setStyle({width:'155px'});
			$('wmv').setStyle({align:'center'});
		}*/
		if($('changeformat-tab') != null)
			$('changeformat-tab').hide();
		
		$('currentformat-tab').update('Your current platform');
		var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
		Event.observe(wmp, 'load', function(event){
			fixPNG(wmp);
		});
		$('currentformat-tab').insert(wmp);
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(wmp);
	    }
		
		
	}
	else
	{
		$('itunes').setStyle({disabled:true}).addClassName('disabled');
		$('wmv').setStyle({disabled:false}).removeClassName('disabled');
		
		$('itunes-section').removeClassName('hidden');
		if(!$('wmv-section').hasClassName('hidden')){
			$('wmv-section').addClassName('hidden');
			$('currentformat-tab').update('Your current platform');
			var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
			Event.observe(itun, 'load', function(event){
				fixPNG(itun);
			});
			$('currentformat-tab').insert(itun);
			
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {
			fixPNG(itun);
		    }
			
		}
	}
}

function fixPNG(myImage) 
{
	if(BrowserDetect.browser == "Explorer")
	{
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7) && (document.body.filters)) 
    {  
      try{
	   var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML
      }
      catch(error){log(error);}
	}
	}
}

/**
 * This method shows the Windows tab.
 * @param showImageWMV
 * @return
 */
function showWMVTab(showImageWMV)
{  
	if(showImageWMV == true)
	{
		$('wmv').hide();
		/*if($('wmvdiv')!=null)
		{
			$('wmvdiv').hide();
			$('itunesdiv').setStyle({width:'155px'});
			$('itunes').setStyle({align:'center'});
		}*/
		if($('changeformat-tab') != null)
			$('changeformat-tab').hide();
		
		$('currentformat-tab').update('Your current platform');
		var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
		Event.observe(itun, 'load', function(event){
			fixPNG(itun);
		});
		$('currentformat-tab').insert(itun);
		
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(itun);
	    }
		
		
	}
	else
	{
		$('wmv').setStyle({disabled:true}).addClassName('disabled');
		$('itunes').setStyle({disabled:false}).removeClassName('disabled');
		$('wmv-section').removeClassName('hidden');
		if(!$('itunes-section').hasClassName('hidden')){
			$('itunes-section').addClassName('hidden');
			$('currentformat-tab').update('Your current platform');
			var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
			Event.observe(wmp, 'load', function(event){
				fixPNG(wmp);
			});
			$('currentformat-tab').insert(wmp);
			
			
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {
			fixPNG(wmp);
		    }
			
		}
	}
}

/**
 * This method builds the support page based on the format selected.
 * @return
 */
function buildSupportFormPage()
{
	if(selectedSource == 'EC')
		buildECSupportForm();
	else
	{
	 /* if('PID'== getDiscCollection(selectedTitle,'PID'))
	   {
		   alert("Please insert the Digital Copy DVD into your DVD drive and click on \"SUPPORT\" in the Digital Copy application to obtain support specific to your purchased DVD and to contact customer support.");
	   }
	   else{*/
	  buildSupportForm1();
	//	   }
	   
	}
}

function positionMainContent(section)
{
	if(section=='Support' || section.include('GettingStarted'))
	{
		if(BrowserDetect.browser == "Explorer")
		{
			if(BrowserDetect.version == "6")
				$('main-content').style.left='-230px';
			else
				$('main-content').style.left='40px';
		}
		else	
			$('main-content').style.left='40px';
	}
	else
	{
		if(BrowserDetect.browser == "Explorer")
		{
			if(BrowserDetect.version == "6")
				$('main-content').style.left='-120px';
			else
				$('main-content').style.left='140px';
		}
		else
			$('main-content').style.left='140px';
	}
}

/**
*	Build the Support section
*/
function buildSupport(questionID) {
	
	
	
	buildLoadingPopup();
	
		log("Support.language : "+Support.language +"Support.language: "+selectedLang);
		if (Support.language == undefined || Support.language != selectedLang) {
			loadSupport();
			
		} else {
			
			
			selectedSection = "Support";
			positionMainContent(selectedSection);
			removeHeaderHighlight();
							
			sendInfoToOmniture(selectedSection);
			if(selectedFAQCategory == "")
				selectedFAQCategory = Support.faq[0].id;
			
			if( selectedTopSupportQue != "" )	{
				if(document.location.hash.include("inapp"))
					buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry+"&faqid="+selectedTopSupportQue+"&inapp=true&code="+authorizationCode);
				else buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry+"&faqid="+selectedTopSupportQue);
			}
			else if(selectedTopSupportQue == "")
			{
				if(document.location.hash.include("inapp"))
				{ buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry+"&categoryid="+selectedFAQCategory+"&inapp=true&code="+authorizationCode);}
				else buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry+"&categoryid="+selectedFAQCategory);
			
			}
			else
			{
				if(document.location.hash.include("inapp"))
					buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry+"&inapp=true&code="+authorizationCode);	
				else buildHash("support-content&discid="+selectedTitle+"&country="+selectedCountry);
			}	
				
			requiredInfoRedirect = "Support";
			
			// build support container
			var supportDiv = new Element('div', {id: 'support-content',name:'support-content'});
			//build div for tabs
			var tabDiv = new Element('div',{id:'support-tab'});
			var currentFormatDiv = new Element('div',{id:'currentformat-tab'});
			var changeFormatDiv = new Element('div',{id:'changeformat-tab'});
			tabDiv.insert(currentFormatDiv);
			tabDiv.insert(changeFormatDiv);
			
			var wmvDiv = new Element('div',{id:'wmvdiv',width:'64px',height:'64px',float:'left'});
			var itunesDiv = new Element('div',{id:'itunesdiv',width:'64px',height:'64px',float:'left'});
			var lineDiv = new Element('div',{id:'line-tab'});
			var wmvTab =new Element('img',{src: 'images/common/logo_wmp.png',id:'wmv',width:'64px',height:'64px'}).addClassName('tab button'); 
			var itunesTab = new Element('img',{src: 'images/common/logo_itunes.png',id:'itunes',width:'64px',height:'64px'}).addClassName('tab button');
			
			// 3/29/2010
			/*itunesDiv.update(itunesTab);
			wmvDiv.update(wmvTab);
			Event.observe(wmvTab, 'load', function(event){
				fixPNG(wmvTab);
			});
			Event.observe(itunesTab, 'load', function(event){
				fixPNG(itunesTab);
				
			});
			*/
			
			
			/*var vlineTable = new Element('table');
			var vlineRow = new Element('tr');
			var vlineCol = new Element('td').setStyle({'border-left': '1px solid blue', 'padding': '3px'});
			vlineRow.insert(vlineCol);
			vlineTable.insert(vlineRow);
			lineDiv.insert(vlineTable);*/
			
			
			// 3/29/2010
			/*changeFormatDiv.insert("");
			if(BrowserDetect.browser == "Explorer")
			{
				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
			    {
					changeFormatDiv.insert(itunesDiv).insert(wmvDiv);
			    }
				else
					changeFormatDiv.insert(itunesTab).insert(wmvTab);
			}
			else
				changeFormatDiv.insert(itunesTab).insert(wmvTab);
			*/
			
			supportDiv.insert(tabDiv);
			supportDiv.insert(lineDiv);
			
			
			// build middle div containing the support faqs
			var middleDiv = new Element('div', {id: 'middle'});
			supportDiv.insert(middleDiv);
			
	
			var title = new Element('div',{align:'center'}).addClassName('title').update("FAQ for "+getDiscTitle(selectedTitle));
			middleDiv.insert(title).insert("<br>");
			
			// build wmv faq-section div
			var wmvFaqDiv = new Element('div', {id: 'wmv-faq-section'}).addClassName('faq-section hidden');
			middleDiv.insert(wmvFaqDiv);
			
			// build itunes faq-section div
			var itunesFaqDiv = new Element('div', {id: 'itunes-faq-section'}).addClassName('faq-section hidden');
			middleDiv.insert(itunesFaqDiv);
			
			// build dcmanager faq-section div
			var dcManagerFaqDiv = new Element('div', {id: 'dcmanager-faq-section'}).addClassName('faq-section hidden');
			middleDiv.insert(dcManagerFaqDiv);
			
			// build dcmobile faq-section div
			var dcMobileFaqDiv = new Element('div', {id: 'dcmobile-faq-section'}).addClassName('faq-section hidden');
			middleDiv.insert(dcMobileFaqDiv);
			//alert('selectedTitle=' + selectedTitle);
			//selectedTitle = '95D4C3DB-0BCB-40fe-ABB7-F06E16D9F23G';
			var wmvCategoryNum = 0;
			var itunesCategoryNum = 0;
			var dcManagerCategoryNum = 0;
			var dcMobileCategoryNum = 0;
			var GDCPIDCountry = getPIDHUBCountry(selectedTitle, selectedCountry,'PID');
			var GDCHUBCountry = getPIDHUBCountry(selectedTitle, selectedCountry,'HUB');
			var GDCNONPIDCountry = getPIDHUBCountry(selectedTitle, selectedCountry,'NON-PID');
			
			var GDCHUBLITECountry = getPIDHUBCountry(selectedTitle, selectedCountry,'HUBLITE');
			var GDCHUBINTLCountry = getPIDHUBCountry(selectedTitle, selectedCountry,'HUBINTL');
			var GDCHUBINTLLITECountry = getPIDHUBCountry(selectedTitle, selectedCountry,'HUBINTLLITE');
			//var GDCTestCountry = getPIDHUBCountry(selectedTitle, selectedCountry,'TEST');
			
			/*if(GDCHUBLITECountry==true)
				{alert("hub lite disc")}
			if(GDCHUBINTLCountry==true)
			{alert("hub INTL disc")}
			if(GDCHUBINTLLITECountry==true)
			{alert("hub INTL LITE disc")}
				*/
				
			//	var discInfo =[];
			/*discInfo = gatherSingleDiscInfo(selectedTitle);	
			discInfo.each ( function(all) {
			//alert(all.discName +" "+all.discLang+" "+all.discSource);
					all.disccountryArr.each ( function(discdetail){ 
							
							//alert(discdetail.countryId);
							discdetail.discformatArr.each(function(discdetailformat){
								
								//alert(discdetailformat.formatName);
					
							});
					});
			
			
			});
			*/
			if(discInfo == null)
			discInfo = gatherSingleDiscInfo(selectedTitle);
			//test
			//alert(getspecificdiscInfo('format','DCMANAGER',selectedTitle));
			//detect if selected disc is expired
			var today = new Date();
			var dd = today.getDate();
			var mm = today.getMonth()+1;
			var yyyy= today.getFullYear();
			if(dd<10){dd='0'+dd}
			if(mm<10){mm='0'+mm}
			var now= mm+'/'+dd+'/'+yyyy;
			var expDate= getspecificdiscInfo('expire','date',selectedTitle);
			
			//(getspecificdiscInfo('expire','date',selectedTitle) =='') ? expDate = getspecificdiscInfo('expire','date',selectedTitle) :expDate = ""; 
			
			if(expDate != '')
			{
				if(compDate(expDate,'MM/dd/yyyy',now,'MM/dd/yyyy') == 1)
				{    //date is not expired yet display regular questions
					
				}
				else{//date is expired show correct questions relating to expired
					var expiretext = "EXPIRE"
					
					if(GDCPIDCountry == true)
						GDCPIDCountry = 'PID'+expiretext;	
					if(GDCNONPIDCountry == true)
						GDCNONPIDCountry = 'NON-PID'+expiretext;
					if(GDCHUBCountry == true)
						GDCHUBCountry = 'HUB'+expiretext;
					if(GDCHUBINTLCountry == true)
						GDCHUBINTLCountry = 'HUBINTL'+expiretext;
					if(GDCHUBLITECountry == true)
						GDCHUBLITECountry = 'HUBLITE'+expiretext;
					if(GDCHUBINTLLITECountry == true)
						GDCHUBINTLLITECountry = 'HUBINTLLITE'+expiretext;
					//if(GDCTestCountry == true)
					//	GDCTestCountry = 'TEST'+expiretext;
				}
				
			}
			//var tmp45 = getspecificdiscInfo('source','dcod',selectedTitle);
			//alert(tmp45);
			//get current domain for special cases in Dev Preview Live
			var currentURL = document.location.href.split(".");
			currentDomainEnv = currentURL[0].charAt(7);
			
			Support.faq.each( function(cat) {
				 
				
				 showWMVCategory = false;
				 showITunesCategory = false;
				 showdcManagerCategory = false;
				 showdcMobileCategory = false;
				
				var wmvpanel = new Element('div',{id:'wmv-panel'}).addClassName('faq-panel hidden');
				var itunespanel = new Element('div',{id:'itunes-panel'}).addClassName('faq-panel hidden');
				var dcmanagerpanel = new Element('div',{id:'dcmanager-panel'}).addClassName('faq-panel hidden');
				var dcmobilepanel = new Element('div',{id:'dcmobile-panel'}).addClassName('faq-panel hidden');
			
			
				
				
				
				cat.items.each( function (item) {
					if(item.id != undefined)
					{   
						
						 
						if(false){}
							item.collectionID.each(function(b){
							   
							if( b.collectid == "TEST" && currentDomainEnv == 'w' )
							{	
							    //alert("found Test attribute");
								passthrough = false;
							
							throw $break;
							}
							else{
								passthrough = true;
							}
							});
						//Testing PID HUB methods
						/*
						if(GDCPIDCountry ==true && GDCHUBCountry ==true)
						{	//alert("special case both PID and HUB"); 	
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" || t.collectid == "HUB" )//|| t.collectid =="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{
								if(qcount<1)  
								   {qcount+=1;
								   
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){
									  
																
											item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;	
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														//if(getspecificdiscInfo('provider',p.providerid,selectedTitle)=='APPLE')
														//alert(getspecificdiscInfo('provider',p.providerid,selectedTitle));
														
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined))
														{
															//alert(p.providerid);
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}
													})
												}	
										})
										
									}
								})
								 				
								}//end if qcount
								
							    }
							})//end fuction(t)
							
						}
						*/
						/***
						 * NONPID faq && HUB  related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == true && GDCHUBCountry == true)
							{    
							//alert("nON-pid and hub");
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "NON-PID" || t.collectid == "HUB")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								  if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
													var providercnt=0;
													item.provider.each(function (p){
														if(providercnt <1){
															providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}
													})//end provider
													
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						*/
						/***
						 * PID faq && HUBLITE  related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCPIDCountry == true && GDCHUBLITECountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" || t.collectid == "HUBLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								  {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						*/
						/***
						 * PID faq && HUBINTLLITE  related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCPIDCountry == true && GDCHUBINTLLITECountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" || t.collectid == "HUBINTLLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						*/
						/***
						 * PID faq && HUBINTL  related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCPIDCountry == true && GDCHUBINTLCountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" || t.collectid == "HUBINTL")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						
						*/
						/***
						 * NON-PID faq && HUBINTL  related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == true && GDCHUBINTLCountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "NON-PID" || t.collectid == "HUBINTL")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						*/
						/***
						 * NON-PID faq && HUBLITE related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == true && GDCHUBLITECountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "NON-PID" || t.collectid == "HUBLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						
						*/
						/***
						 * NON-PID faq && HUBINTLLITE related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == true && GDCHUBINTLLITECountry == true)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "NON-PID" || t.collectid == "HUBINTLLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   if(qcount<1)  
								   {qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								}//remove qcount if
								
							    }
							})//end fuction(t)
						}	 
						
						
						*/
						/***
						 * PID faq related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCPIDCountry == true && GDCHUBCountry == false && GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false && GDCNONPIDCountry == false)
							{    
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							///var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" )//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   //if(qcount<1)  
								   //{qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								//}remove qcount if
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * NONPID faq related information
						 */
						/*
						//if(  (GDCPID!= undefined && GDCPID=='PID') && (getPIDHUBCountry(selectedTitle, selectedCountry,'PID')== true))// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == true && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false)
							{    
							
							//"PID exists";
							//MUST SATISFY SPECIAL CASE, FAQ could have both PID and HUB; results in duplicate faq
							//To Counter duplicate faq's initialize counter
							///var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "NON-PID")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								   //if(qcount<1)  
								   //{qcount+=1;
								  item.source.each(function (s){
										//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
									  if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
										  
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();	
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
												
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
														if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
															
															if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																		
																	showITunesCategory=true;
															}	
															else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
															else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
															else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
													}})
												}	
										})
										
									}
								})
								 				
								//}remove qcount if
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * HUB faq related informtation
						 */
						/*
						//if(  (GDCHUB!= undefined && GDCHUB=='HUB') && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')== true)// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
				else if(GDCNONPIDCountry == false && GDCHUBCountry == true && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false)
							{ 
							  
							item.collectionID.each(function(b){
							//check to see if we should display info for HUB
							  if( b.collectid == "HUB" || b.collectid ==undefined || b.collectid =="" )
								{
								  
								  item.source.each(function (d){
										//if((d.sourceid == getDiscSource(selectedTitle, d.sourceid ) || d.sourceid  == undefined)){
									    // alert("d.sourceid "+d.sourceid+" getspecifiedsouce "+getspecificdiscInfo('source',d.sourceid,selectedTitle));
									  if((d.sourceid == getspecificdiscInfo('source',d.sourceid,selectedTitle) || d.sourceid  == undefined)){
										// alert("HUB info");
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
													
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
													   if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
														   
														   if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																	showITunesCategory=true;
															}
														   else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
														   else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
														   else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
												}})
												}	
										})
										
									}
								})
								 				
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * HUBLITE faq related informtation
						 */
						/*
						//if(  (GDCHUB!= undefined && GDCHUB=='HUB') && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')== true)// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == true && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false
)
							{ 
							  
							item.collectionID.each(function(b){
							//check to see if we should display info for HUB
							  if( b.collectid == "HUBLITE" || b.collectid ==undefined || b.collectid =="" )
								{
								  
								  item.source.each(function (d){
										//if((d.sourceid == getDiscSource(selectedTitle, d.sourceid ) || d.sourceid  == undefined)){
									    // alert("d.sourceid "+d.sourceid+" getspecifiedsouce "+getspecificdiscInfo('source',d.sourceid,selectedTitle));
									  if((d.sourceid == getspecificdiscInfo('source',d.sourceid,selectedTitle) || d.sourceid  == undefined)){
										// alert("HUB info");
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
													
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
													   if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
														   
														   if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																	showITunesCategory=true;
															}
														   else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
														   else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
														   else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
												}})
												}	
										})
										
									}
								})
								 				
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * HUBINTLITE faq related informtation
						 */
						/*
						//if(  (GDCHUB!= undefined && GDCHUB=='HUB') && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')== true)// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == true
)
							{ 
							  
							item.collectionID.each(function(b){
							//check to see if we should display info for HUB
							  if( b.collectid == "HUBINTLLITE" || b.collectid ==undefined || b.collectid =="" )
								{
								  
								  item.source.each(function (d){
										//if((d.sourceid == getDiscSource(selectedTitle, d.sourceid ) || d.sourceid  == undefined)){
									    // alert("d.sourceid "+d.sourceid+" getspecifiedsouce "+getspecificdiscInfo('source',d.sourceid,selectedTitle));
									  if((d.sourceid == getspecificdiscInfo('source',d.sourceid,selectedTitle) || d.sourceid  == undefined)){
										// alert("HUB info");
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
													
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
													   if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
														   
														   if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																	showITunesCategory=true;
															}
														   else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
														   else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
														   else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
												}})
												}	
										})
										
									}
								})
								 				
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * HUBINTL faq related informtation
						 */
						/*
						//if(  (GDCHUB!= undefined && GDCHUB=='HUB') && getPIDHUBCountry(selectedTitle, selectedCountry,'HUB')== true)// ||  (GDCHUB!= undefined && GDCHUB=='HUB') )
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==true && GDCHUBINTLLITECountry == false
)
							{ 
							  
							item.collectionID.each(function(b){
							//check to see if we should display info for HUB
							  if( b.collectid == "HUBINTL" || b.collectid ==undefined || b.collectid =="" )
								{
								  
								  item.source.each(function (d){
										//if((d.sourceid == getDiscSource(selectedTitle, d.sourceid ) || d.sourceid  == undefined)){
									    // alert("d.sourceid "+d.sourceid+" getspecifiedsouce "+getspecificdiscInfo('source',d.sourceid,selectedTitle));
									  if((d.sourceid == getspecificdiscInfo('source',d.sourceid,selectedTitle) || d.sourceid  == undefined)){
										// alert("HUB info");
										  item.format.each(function(f){
											var fID = f.formatid;
											if(f.formatid != undefined)
											{
												//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
												fID = fID.toLowerCase();
											}
											//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
											if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
													
												var providercnt=0;
												item.provider.each(function (p){
													if(providercnt <1){
														providercnt+=1;
														//if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
													   if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
														   
														   if(fID == 'itunes' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(que, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																itunespanel.insert(qaDiv);
																//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
																if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
																	showITunesCategory=true;
															}
														   else if(f.formatid == 'WMV' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																wmvpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
																	showWMVCategory=true;
															}
														   else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmanagerpanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
																	showdcManagerCategory=true;
															}
														   else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
															{
																var que = new Element('span').update(item.question);
																var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																var a = new Element('div').addClassName('answer hidden').update(item.answer);
																Event.observe(q, 'click', function(event){
																	showHideAnswer(event);
																});
																Event.observe(que, 'mouseover', function(event){
																	que.addClassName('onhoversupport');
																});
																Event.observe(q, 'mouseout', function(event){
																	que.removeClassName('onhoversupport');
																});
																var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																dcmobilepanel.insert(qaDiv);
																//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
																if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
																	showdcMobileCategory=true;
															}
														}
												}})
												}	
										})
										
									}
								})
								 				
								
							    }
							})//end fuction(t)
						}
						*/
						/***
						 * NOT HUB or PID or other added options so display default information NEW OPTIMIZED METHOD getspecificdiscInfo();
						 */
						/*
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false
 ){	
							//Disc doesnt have collection attribute Specific
							 //alert("need to get in here");
							var qcount=0; 
						//	item.collectionID.each(function(p){
							  //check to see if we should not display info because PID tag is present
							 // if(p.collectid != 'PID' && p.collectid != 'HUB'){ //begin inner IF
								
								  if(qcount<1000)  
								   {qcount+=1;
								  //  alert("PID false?="+t.collectid);
								  
						//item.source.each(function (s){
									  
									  
									 ///testing
							
							//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
							//if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){
						//if((s.sourceid == s.sourceid || s.sourceid  == undefined)){
								
							item.format.each(function(f){
							
								
								
							var fID = f.formatid;
							if(f.formatid != undefined)
							{
								//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
								fID = fID.toLowerCase();
							}
							//alert("f.formatid "+f.formatid+" discformat"+getDiscFormat(selectedTitle, f.formatid));
							//if((fID == getDiscFormat(selectedTitle, f.formatid).toLowerCase() || f.formatid == undefined)){
							//  if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){		
							if((fID == fID || f.formatid == undefined)){	
								  //item.provider.each(function (p){
										//alert(item.question);
									  //if((p.providerid == getDiscProvider(selectedTitle, p.providerid) || p.providerid == undefined)){
									  //if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
										//if((p.providerid == p.providerid || p.providerid == undefined)){
										  if(fID == 'itunes' || f.formatid == undefined)
											{
												var que = new Element('span').update(item.question);
												var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
												var a = new Element('div').addClassName('answer hidden').update(item.answer);
												Event.observe(q, 'click', function(event){
													showHideAnswer(event);
												});
												Event.observe(que, 'mouseover', function(event){
													que.addClassName('onhoversupport');
												});
												Event.observe(que, 'mouseout', function(event){
													que.removeClassName('onhoversupport');
												});
												var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
												itunespanel.insert(qaDiv);
												//if('itunes' == getDiscFormat(selectedTitle, 'itunes'))
												//if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
												//if('itunes' == 'itunes')
													showITunesCategory=true;
												   														
											}
										  else if(f.formatid == 'WMV' || f.formatid == undefined)
											{
												var que = new Element('span').update(item.question);
												var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
												var a = new Element('div').addClassName('answer hidden').update(item.answer);
												Event.observe(q, 'click', function(event){
													showHideAnswer(event);
												});
												Event.observe(que, 'mouseover', function(event){
													que.addClassName('onhoversupport');
												});
												Event.observe(q, 'mouseout', function(event){
													que.removeClassName('onhoversupport');
												});
												var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
												wmvpanel.insert(qaDiv);
												//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
												//if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
												//if('wmv' == 'wmv')	
												showWMVCategory=true;
											}
										  else  if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
											{
												var que = new Element('span').update(item.question);
												var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
												var a = new Element('div').addClassName('answer hidden').update(item.answer);
												Event.observe(q, 'click', function(event){
													showHideAnswer(event);
												});
												Event.observe(que, 'mouseover', function(event){
													que.addClassName('onhoversupport');
												});
												Event.observe(q, 'mouseout', function(event){
													que.removeClassName('onhoversupport');
												});
												var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
												dcmanagerpanel.insert(qaDiv);
												//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
												//if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
												//if('dcmanager' == 'dcmanager')	
												showdcManagerCategory=true;
											}
										  else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
											{
												//alert(item.question + " " +p.providerid);
											  	var que = new Element('span').update(item.question);
												var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
												var a = new Element('div').addClassName('answer hidden').update(item.answer);
												Event.observe(q, 'click', function(event){
													showHideAnswer(event);
												});
												Event.observe(que, 'mouseover', function(event){
													que.addClassName('onhoversupport');
												});
												Event.observe(q, 'mouseout', function(event){
													que.removeClassName('onhoversupport');
												});
												var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
												dcmobilepanel.insert(qaDiv);
												//if('WMV' == getDiscFormat(selectedTitle, 'WMV'))
												//if('dcmobile' == getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase())
												//if('dcmobile' == 'dcmobile')	
												showdcMobileCategory=true;
											}
									//	}//removal of  if p.provider id
									//})//removal of p.provider loop
								}	
						})
						
					//}//removal of if source
			//	})
								}
							//}//end Inner if p.collect...
						  //    })//end function (p)	
						
						
						
						}//end new optimized method else if
						
						*/
						/* --------------------------------------------Begin Regular FAQ Section----------------------------------------*/
						/**
						 *   PID only
						 *   
						 */
						if(GDCPIDCountry == true && GDCHUBCountry == false && GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false && GDCNONPIDCountry == false  )
							{    
							item.collectionID.each(function(t){
							  if(t.collectid == "PID" )//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{ 
								  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   NON-PID only
						 *   
						 */
						else if(GDCNONPIDCountry == true && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false )
						{    
						
						item.collectionID.each(function(t){
						  if(t.collectid == "NON-PID")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							
						    }
						})//end fuction(t)
						}
						/**
						 *   HUB only
						 *   
						 */
						else if(GDCNONPIDCountry == false && GDCHUBCountry == true && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false )
						{ 
						  
						item.collectionID.each(function(b){
						//check to see if we should display info for HUB
						  if( b.collectid == "HUB" || b.collectid ==undefined || b.collectid =="" )
							{
							  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
						    }
						})//end fuction(t)
						}
						/**
						 *   HUBINTL only
						 *   
						 */
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==true && GDCHUBINTLLITECountry == false 
						)
													{ 
													  
													item.collectionID.each(function(b){
													//check to see if we should display info for HUB
													  if( b.collectid == "HUBINTL" || b.collectid ==undefined || b.collectid =="" )
														{
														  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
													    }
													})//end fuction(t)
												}
						/**
						 *   HUBLITE only
						 *   
						 */
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == true && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false 
						)
												{ 
													  
													item.collectionID.each(function(b){
													//check to see if we should display info for HUB
													  if( b.collectid == "HUBLITE" || b.collectid ==undefined || b.collectid =="" )
														{
														  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
													    }
													})//end fuction(t)
												}
						/**
						 *   HUBINTLLITE only
						 *   
						 */
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == true 
						)
													{ 
													  
													item.collectionID.each(function(b){
													//check to see if we should display info for HUB
													  if( b.collectid == "HUBINTLLITE" || b.collectid ==undefined || b.collectid =="" )
														{
														  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);														
													    }
													})//end fuction(t)
												}
						/**
						 *   PID && HUB only
						 *   
						 */
						else if(GDCPIDCountry ==true && GDCHUBCountry ==true)
						{	//alert("special case both PID and HUB"); 	
							var qcount=0;
							item.collectionID.each(function(t){
							//check to see if we should display info for PID
							  if(t.collectid == "PID" || t.collectid == "HUB" )//|| t.collectid =="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
								{
								if(qcount<1)  
								   {qcount+=1;
								   
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);			
								}//end if qcount
								
							    }
							})//end fuction(t)
							
						}
						/**
						 *   PID && HUBINTL only
						 *   
						 */
						else if(GDCPIDCountry == true && GDCHUBINTLCountry == true)
						{    
						
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "PID" || t.collectid == "HUBINTL")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							   }//remove qcount if
							
						    }
						})//end fuction(t)
						}	 
						/**
						 *   PID && HUBLITE only
						 *   
						 */
						else if(GDCPIDCountry == true && GDCHUBLITECountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "PID" || t.collectid == "HUBLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							  {qcount+=1;
							  supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);			
							  }//remove qcount if
							
						    }
						})//end fuction(t)
						}
						/**
						 *   PID && HUBINTLLITE only
						 *   
						 */
						else if(GDCPIDCountry == true && GDCHUBINTLLITECountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "PID" || t.collectid == "HUBINTLLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							   }//remove qcount if
						    }
						})//end fuction(t)
						}
						/**
						 *   NONPID && HUB only
						 *   
						 */
						else if(GDCNONPIDCountry == true && GDCHUBCountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "NON-PID" || t.collectid == "HUB")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							  if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);		
							   }//remove qcount if
							
						    }
						})//end fuction(t)
						}
						/**
						 *   NONPID && HUBINTL only
						 *   
						 */
						else if(GDCNONPIDCountry == true && GDCHUBINTLCountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "NON-PID" || t.collectid == "HUBINTL")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							   }//remove qcount if
							
						    }
						})//end fuction(t)
						}
						/**
						 *   NONPID&& HUBLITE only
						 *   
						 */
						else if(GDCNONPIDCountry == true && GDCHUBLITECountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "NON-PID" || t.collectid == "HUBLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);		
							   }//remove qcount if
						    }
						})//end fuction(t)
						}
						
						/**
						 *   NONPID && HUBINTLLITE only
						 *   
						 */
						else if(GDCNONPIDCountry == true && GDCHUBINTLLITECountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "NON-PID" || t.collectid == "HUBINTLLITE")//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							   }//remove qcount if
							
						    }
						})//end fuction(t)
						}
						/**
						 *   Testing
						 *   
						 */
						/*else if(GDCTestCountry == true)
						{    
						var qcount=0;
						item.collectionID.each(function(t){
						  if(t.collectid == "TEST" )//|| t.collectid=="" || t.collectid ==undefined)//|| t.collectid == GDCHUB)
							{ 
							   if(qcount<1)  
							   {qcount+=1;
							   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel,item.collectionID);
							   }//remove qcount if
							
						    }
						})//end fuction(t)
						}*/
						/***
						 * NOT HUB or PID or other added options so display default information NEW OPTIMIZED METHOD getspecificdiscInfo();
						 */
						else if(GDCNONPIDCountry == false && GDCHUBCountry == false && GDCPIDCountry == false &&  GDCHUBLITECountry == false && GDCHUBINTLCountry==false && GDCHUBINTLLITECountry == false 
						 ){	
													var qcount=0; 
														  if(qcount<1000)  
														   {qcount+=1;
														
													item.format.each(function(f){
													var fID = f.formatid;
													if(f.formatid != undefined)
													{
														//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
														fID = fID.toLowerCase();
													}
													if((fID == fID || f.formatid == undefined)){	
																  if(fID == 'itunes' || f.formatid == undefined)
																	{
																		var que = new Element('span').update(item.question);
																		var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																		var a = new Element('div').addClassName('answer hidden').update(item.answer);
																		Event.observe(q, 'click', function(event){
																			showHideAnswer(event);
																		});
																		Event.observe(que, 'mouseover', function(event){
																			que.addClassName('onhoversupport');
																		});
																		Event.observe(que, 'mouseout', function(event){
																			que.removeClassName('onhoversupport');
																		});
																		var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																		itunespanel.insert(qaDiv);
																			showITunesCategory=true;
																	}
																  else if(f.formatid == 'WMV' || f.formatid == undefined)
																	{
																		var que = new Element('span').update(item.question);
																		var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																		var a = new Element('div').addClassName('answer hidden').update(item.answer);
																		Event.observe(q, 'click', function(event){
																			showHideAnswer(event);
																		});
																		Event.observe(que, 'mouseover', function(event){
																			que.addClassName('onhoversupport');
																		});
																		Event.observe(q, 'mouseout', function(event){
																			que.removeClassName('onhoversupport');
																		});
																		var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																		wmvpanel.insert(qaDiv);
																		showWMVCategory=true;
																	}
																  else  if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
																	{
																		var que = new Element('span').update(item.question);
																		var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																		var a = new Element('div').addClassName('answer hidden').update(item.answer);
																		Event.observe(q, 'click', function(event){
																			showHideAnswer(event);
																		});
																		Event.observe(que, 'mouseover', function(event){
																			que.addClassName('onhoversupport');
																		});
																		Event.observe(q, 'mouseout', function(event){
																			que.removeClassName('onhoversupport');
																		});
																		var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																		dcmanagerpanel.insert(qaDiv);
																		showdcManagerCategory=true;
																	}
																  else if(f.formatid == 'DCMOBILE' || f.formatid == undefined)
																	{
																		//alert(item.question + " " +p.providerid);
																	  	var que = new Element('span').update(item.question);
																		var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
																		var a = new Element('div').addClassName('answer hidden').update(item.answer);
																		Event.observe(q, 'click', function(event){
																			showHideAnswer(event);
																		});
																		Event.observe(que, 'mouseover', function(event){
																			que.addClassName('onhoversupport');
																		});
																		Event.observe(q, 'mouseout', function(event){
																			que.removeClassName('onhoversupport');
																		});
																		var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
																		dcmobilepanel.insert(qaDiv);
																		showdcMobileCategory=true;
																	}
														}	
												})
										}
						}//end new optimized method else if
						/* --------------------------------------------End Regular FAQ Section----------------------------------------*/
						/* --------------------------------------------Begin Expired FAQ Section----------------------------------------*/
						/**
						 *   PIDEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry == 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "PIDEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   NON-PIDEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry == 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "NON-PIDEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   HUBEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry == 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "HUBEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   HUBINTLEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry == 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "HUBEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   HUBLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry == 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "HUBEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   HUBINTLLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry == 'HUBINTLLITEEXPIRE' )
						{
							
							item.collectionID.each(function(b){
								if( b.collectid == "HUBEXPIRE" || b.collectid ==undefined || b.collectid =="" )
								{ 
								   supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
							    }
							})//end fuction(t)
						}
						/**
						 *   PIDEXPIRE && HUBEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry == 'PIDEXPIRE' && GDCHUBCountry == 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "PIDEXPIRE" || b.collectid == "HUBEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   PIDEXPIRE && HUBINTLEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry == 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry == 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "PIDEXPIRE" || b.collectid == "HUBINTLEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   PIDEXPIRE && HUBLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry == 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry == 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "PIDEXPIRE" || b.collectid == "HUBLITEEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   PIDEXPIRE && HUBINTLLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry == 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry != 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry == 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "PIDEXPIRE" || b.collectid == "HUBINTLLITEEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   NONPIDEXPIRE && HUBEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry == 'HUBEXPIRE' && GDCNONPIDCountry == 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{ 
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "NON-PIDEXPIRE" || b.collectid == "HUBEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   NONPIDEXPIRE && HUBINTLEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry == 'NON-PIDEXPIRE' && GDCHUBINTLCountry == 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "NON-PIDEXPIRE" || b.collectid == "HUBINTLEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   NONPIDEXPIRE && HUBLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry == 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry == 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry != 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "NON-PIDEXPIRE" || b.collectid == "HUBLITEEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   NONPIDEXPIRE && HUBINTLLITEEXPIRE only
						 *   
						 */
						else if(GDCPIDCountry != 'PIDEXPIRE' && GDCHUBCountry != 'HUBEXPIRE' && GDCNONPIDCountry == 'NON-PIDEXPIRE' && GDCHUBINTLCountry != 'HUBINTLEXPIRE' && GDCHUBLITECountry != 'HUBLITEEXPIRE' && GDCHUBINTLLITECountry == 'HUBINTLLITEEXPIRE' )
						{
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "NON-PIDEXPIRE" || b.collectid == "HUBINTLLITEEXPIRE" )
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel);
									   }
							    }
							})//end fuction(t)
						}
						/**
						 *   testing only
						 *   
						 */
						/*else if(GDCTestCountry == 'TESTEXPIRE')
						{ 
							var qcount=0;
							item.collectionID.each(function(b){
								if( b.collectid == "TESTEXPIRE")
								{ 
									 if(qcount<1)  
									   {qcount+=1;
									supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel,item.collectionID);
									   }
							    }
							})//end fuction(t)
						}*/
						/*---------------------------------------------End Expired FAQ Section-------------------------------------------*/
				}
				});
				
				if(showWMVCategory == true)
				{
					wmvFaqDiv.removeClassName('hidden');
					//Show category only when there are questions under it
					wmvCategoryNum++;
					
					if(wmvCategoryNum == 1)
					{
						wmvpanel.removeClassName('hidden');
					}
					
					var catDiv = new Element('div', {width: '502', height:'15', align:'left'}).addClassName('category-header button').update(cat.label);
					var catHeader = new Element('h3', {id: cat.id}).insert(catDiv);
					wmvFaqDiv.insert(catHeader);
					catDiv.observe('click', showHideSection);
					catDiv.observe('mouseover', function () {
						this.toggleClassName('selected');
					});
					catDiv.observe('mouseout', function () {
						
					});
					wmvFaqDiv.insert(wmvpanel);
				}
				if(showITunesCategory == true)
				{   //3/30/2010
					itunesFaqDiv.removeClassName('hidden');
					//Show category only when there are questions under it
					itunesCategoryNum = itunesCategoryNum+1;
				
					if(itunesCategoryNum == 1)
					{
						itunespanel.removeClassName('hidden');
					}
					var catDiv = new Element('div', {width: '502', height:'15', align:'left'}).addClassName('category-header button').update(cat.label);
					var catHeader = new Element('h3', {id: cat.id}).insert(catDiv);
					itunesFaqDiv.insert(catHeader);
					catDiv.observe('click', showHideSection);
					catDiv.observe('mouseover', function () {
						this.toggleClassName('selected');
					});
					catDiv.observe('mouseout', function () {
						
					});
					itunesFaqDiv.insert(itunespanel);
				}
				if(showdcManagerCategory == true)
				{
				    dcManagerFaqDiv.removeClassName('hidden');
					//Show category only when there are questions under it
				    dcManagerCategoryNum = dcManagerCategoryNum+1;
				
					if(dcManagerCategoryNum == 1)
					{
						dcmanagerpanel.removeClassName('hidden');
					}
					var catDiv = new Element('div', {width: '502', height:'15', align:'left'}).addClassName('category-header button').update(cat.label);
					var catHeader = new Element('h3', {id: cat.id}).insert(catDiv);
					dcManagerFaqDiv.insert(catHeader);
					catDiv.observe('click', showHideSection);
					catDiv.observe('mouseover', function () {
						this.toggleClassName('selected');
					});
					catDiv.observe('mouseout', function () {
						
					});
					dcManagerFaqDiv.insert(dcmanagerpanel);
				}
				if(showdcMobileCategory == true)
				{
				    dcMobileFaqDiv.removeClassName('hidden');
					//Show category only when there are questions under it
				    dcMobileCategoryNum = dcMobileCategoryNum+1;
				
					if(dcMobileCategoryNum == 1)
					{
						dcmobilepanel.removeClassName('hidden');
					}
					var catDiv = new Element('div', {width: '502', height:'15', align:'left'}).addClassName('category-header button').update(cat.label);
					var catHeader = new Element('h3', {id: cat.id}).insert(catDiv);
					dcMobileFaqDiv.insert(catHeader);
					catDiv.observe('click', showHideSection);
					catDiv.observe('mouseover', function () {
						this.toggleClassName('selected');
					});
					catDiv.observe('mouseout', function () {
						
					});
					dcMobileFaqDiv.insert(dcmobilepanel);
				}
			});		
			
			$('main-content').update(supportDiv);
			
			//hide the tab if there are no faqs of that format
			if(selectedFormat != "")
			{	
				//alert(getspecificdiscInfo('format',selectedFormat,selectedTitle).toLowerCase()+ " here "+selectedFormat);
				//alert(selectedFormat);
				if(getspecificdiscInfo('format',selectedFormat,selectedTitle).toLowerCase() != selectedFormat)
				{// means in application they have changed there disc selection to a new one with new formats
				 // the format var at this point has the old format value, so check if current selected title has the old format
				 // if not then set a default for the current disc.
					
					if(getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase() == 'wmv')
					{	buildQuestionArea('wmv');
					}
					else if(getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase() == 'itunes')
					{	buildQuestionArea('itunes');
					}
					else if(getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase() == 'dcmanager')
					{	
						buildQuestionArea('dcmanager');
					}
					else if(getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase() == 'dcmobile')
					{	buildQuestionArea('dcmobile');
					}
					else{
						
						buildQuestionArea('wmv');
					}
					
				}
				else if(selectedFormat.toLowerCase()== "wmv")
				{
					
					buildQuestionArea('wmv');
					//showItunesSupport(itunesCategoryNum);
					//showWMVSupport(wmvCategoryNum);	
				}
				else if(selectedFormat.toLowerCase()== "itunes")
				{
					
					buildQuestionArea('itunes');
					//showWMVSupport(wmvCategoryNum);
					//showItunesSupport(itunesCategoryNum);
				}
				else if(selectedFormat.toLowerCase()== "dcmanager")
				{	
					buildQuestionArea('dcmanager');
					//showWMVSupport(wmvCategoryNum);
					//showItunesSupport(itunesCategoryNum);
				}
				else if(selectedFormat.toLowerCase()== "dcmobile")
				{
					buildQuestionArea('dcmobile');
					//showWMVSupport(wmvCategoryNum);
					//showItunesSupport(itunesCategoryNum);
				}
				
				
			}
			else
			{	
				//need better way of setting default format
				if(getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase() == 'dcmanager' && selectedFAQCategory == "")
				{
					setFormat('dcmanager');
					buildQuestionArea('dcmanager');
				}
				else if(getspecificdiscInfo('format','dcmobile',selectedTitle).toLowerCase() == 'dcmobile' && selectedFAQCategory == "")
				{
					setFormat('dcmobile');
					buildQuestionArea('dcmobile');
				}
				else{
				
				setFormat('wmv');
				buildQuestionArea('wmv');
				//showItunesSupport(itunesCategoryNum);
				//showWMVSupport(wmvCategoryNum);
				}
			}
			/* 3/29/2010
			$('wmv').observe('click',function(){
				onChangeWMVSupport();
				
			});
			$('itunes').observe('click', function(){
				onChangeITunesSupport();
			});
			if($('wmvdiv')!=null){
				$('wmvdiv').observe('click',function(){
					onChangeWMVSupport();
					
				});
			}
			if($('itunesDiv') != null){
				$('itunesDiv').observe('click', function(){
					onChangeITunesSupport();
				});
			}
			*/
			log("selectedTopSupportQue: "+selectedTopSupportQue);
			log("selectedFAQCategory: "+selectedFAQCategory);
		
			//show the faq answer for the top ranked question in the home page(deep linking)
			
			if(selectedTopSupportQue!="")
			{ 
				if($(selectedTopSupportQue))
				{		if ($(selectedTopSupportQue).parentNode.parentNode.id)
						{
							var sectiontoShow = $(selectedTopSupportQue).parentNode.parentNode.id;
							if(sectiontoShow == 'wmv-panel')
							{
								onChangeWMVSupport();
								updateSupportSelectionTab('wmv', "wmv Top support Que");
							}
							else if(sectiontoShow == 'itunes-panel')
							{
								onChangeITunesSupport();
								updateSupportSelectionTab('itunes', "itunes Top support Que");
							}
							else if(sectiontoShow == 'dcmanager-panel')
							{
								onChangedcManagerSupport();
								updateSupportSelectionTab('dcmanager', "dcmanager Top support Que");
							}
							else if(sectiontoShow == 'dcmobile-panel')
							{
								onChangedcMobileSupport();
								updateSupportSelectionTab('dcmobile', "dcmobile Top support Que");
							}
						}
					
				}
				Support.faq.each( function(cat) {
				if (selectedFAQCategory == cat.id) 
				{
					if($(cat.id) != null)
						$(cat.id).next('.faq-panel').addClassName('hidden');
				}
				cat.items.each( function (item) {
					//log('questionID: '+selectedTopSupportQue +' itemID: '+item.id);
					log(item.id);
					if(selectedTopSupportQue == item.id)
					{
						log("cat id= "+cat.id+ " itemid= "+item.id);
						if($(cat.id) != null && $(item.id) != null)
						{
							//$(cat.id).next('.faq-panel').removeClassName('hidden');
							$A($(document.body).getElementsByClassName("faq-panel")).each(function(f) {
								f.addClassName('hidden');
							});
							var nextq = $(item.id).next('.answer').removeClassName('hidden');
							var faq = nextq.parentNode;
							faq.parentNode.removeClassName('hidden');
							
							//$('Code_Required').next('.answer').removeClassName('hidden');
						}
					}
				});
				});	
			}
			else if(selectedFAQCategory != "" && selectedTopSupportQue == "")
			{		
					if($(selectedFAQCategory))
					{		
						
						if ($(selectedFAQCategory).parentNode.id)
							{
								var catsectiontoShow = $(selectedFAQCategory).parentNode.id;
								if(catsectiontoShow == 'wmv-faq-section')
								{ 
									onChangeWMVSupport();
									buildQuestionArea('wmv');
									//updateSupportSelectionTab('wmv', "wmv FAQ Category");
								}
								else if(catsectiontoShow == 'itunes-faq-section')
								{
									onChangeITunesSupport();
									buildQuestionArea('itunes');
									//updateSupportSelectionTab('itunes', "itunes FAQ Category");
								}
								else if(catsectiontoShow == 'dcmanager-faq-section')
								{
									onChangedcManagerSupport();
									buildQuestionArea('dcmanager');
									//updateSupportSelectionTab('dcmanager', "dcmanager FAQ Category");
								}
								else if(catsectiontoShow == 'dcmobile-faq-section')
								{
									onChangedcMobileSupport();
									buildQuestionArea('dcmobile');
									//updateSupportSelectionTab('dcmobile', "dcmobile FAQ Category");
								}
								
							}
						
					}
				
				
				
				Support.faq.each( function(cat) {
					if (selectedFAQCategory == cat.id) 
					{
						if($(cat.id) != null)
							$(cat.id).next('.faq-panel').removeClassName('hidden');
					}
					else{
						if($(cat.id) != null)
							$(cat.id).next('.faq-panel').addClassName('hidden');
					}
					});	
			}
			
			removeLoadingPopup();
			
			buildHeader();
			buildFooter();
			if(selectedSource == 'EC')
			{
				buildLanguageSelector();
				buildSectionTitle("SUPPORT");
			}
			else
			{
				buildLanguageSelector(Support);
				buildSectionTitle(Support);
			}
			clearCountrySelector();
			clearUpdates();
			buildStoredInfo();
//			if($('support-button') != null)
//				$('support-button').addClassName('sectionselect');
			
			
		/* 3/22/2010	
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(itunesTab);fixPNG(wmvTab);
	    }
		*/
	
		if(selectedTopSupportQue !="")
		{var tmphashlocation =document.location.hash;
		window.location.hash=selectedTopSupportQue;
		buildHash(tmphashlocation);
		}
		
		
		if(datecountryFormat(getspecificdiscInfo('expire','date',selectedTitle),selectedCountry)!= '')
		{ // display expired date under nav menu
			$('expire-info').update('');			
			var discexpireDate = getspecificdiscInfo('expire','date',selectedTitle);
			$('expire-info').insert("Digital Copy Offer Expires:<br/>"+ discexpireDate);
		}
		
		
		
		
		
	}
	
	
}

function supportFAQHelper(item,wmvpanel,itunespanel,dcmanagerpanel,dcmobilepanel){
	
	
	var passthroughFAQ= true;
	
	/*collection.each(function(b){
	   
		if( b.collectid == "TEST" && currentDomainEnv == 'w' )
		{	
		passthrough = false;
		throw $break;
		}
		else{
			passthrough = true;
		}
		});
		*/	
	/*if(collection == false)
	{
		
		passthroughFAQ = false;
	}*/
	
	
	
	if(passthrough)
	{
	item.source.each(function (s){
		//if((s.sourceid == getDiscSource(selectedTitle, s.sourceid ) || s.sourceid  == undefined)){
	 
		if((s.sourceid == getspecificdiscInfo('source',s.sourceid,selectedTitle) || s.sourceid  == undefined)){				
		  
		  item.format.each(function(f){
			var fID = f.formatid;
			if(f.formatid != undefined)
			{
				//for making 'iTunes' case sensitive as it is entered as 'ITUNES' in stellent
				fID = fID.toLowerCase();	
			}
			if((fID == getspecificdiscInfo('format',f.formatid,selectedTitle).toLowerCase() || f.formatid == undefined)){
				
				var providercnt=0;
				item.provider.each(function (p){
						if((p.providerid == getspecificdiscInfo('provider',p.providerid,selectedTitle) || p.providerid == undefined)){
							
							var fmpstr= f.formatid+","+p.providerid;
							if(getspecificdiscInfo('formatmatchprovider',fmpstr,selectedTitle) == true || p.providerid == undefined)
							{
							if(fID == 'itunes' || f.formatid == undefined)
							{
								var que = new Element('span').update(item.question);
								var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
								var a = new Element('div').addClassName('answer hidden').update(item.answer);
								Event.observe(q, 'click', function(event){
									showHideAnswer(event);
								});
								Event.observe(que, 'mouseover', function(event){
									que.addClassName('onhoversupport');
								});
								Event.observe(que, 'mouseout', function(event){
									que.removeClassName('onhoversupport');
								});
								var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
								itunespanel.insert(qaDiv);
								if('itunes' == getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase())
										
									showITunesCategory=true;
							}	
							else if(f.formatid == 'WMV' || f.formatid == undefined)
							{
								var que = new Element('span').update(item.question);
								var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
								var a = new Element('div').addClassName('answer hidden').update(item.answer);
								Event.observe(q, 'click', function(event){
									showHideAnswer(event);
								});
								Event.observe(que, 'mouseover', function(event){
									que.addClassName('onhoversupport');
								});
								Event.observe(q, 'mouseout', function(event){
									que.removeClassName('onhoversupport');
								});
								var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
								wmvpanel.insert(qaDiv);
								if('wmv' == getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase())
									showWMVCategory=true;
							}
							else if(f.formatid == 'DCMANAGER' || f.formatid == undefined)
							{
								var que = new Element('span').update(item.question);
								var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
								var a = new Element('div').addClassName('answer hidden').update(item.answer);
								Event.observe(q, 'click', function(event){
									showHideAnswer(event);
								});
								Event.observe(que, 'mouseover', function(event){
									que.addClassName('onhoversupport');
								});
								Event.observe(q, 'mouseout', function(event){
									que.removeClassName('onhoversupport');
								});
								var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
								dcmanagerpanel.insert(qaDiv);
								if('dcmanager' == getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase())
									showdcManagerCategory=true;
							}
							else if(f.formatid == 'DCMMOBILE' || f.formatid == undefined)
							{
								var que = new Element('span').update(item.question);
								var q = new Element('div',{id:item.id}).addClassName('question').insert(new Element('div').addClassName('arrow-icon')).insert(que);
								var a = new Element('div').addClassName('answer hidden').update(item.answer);
								Event.observe(q, 'click', function(event){
									showHideAnswer(event);
								});
								Event.observe(que, 'mouseover', function(event){
									que.addClassName('onhoversupport');
								});
								Event.observe(q, 'mouseout', function(event){
									que.removeClassName('onhoversupport');
								});
								var qaDiv = new Element('div').addClassName('faq').insert(q).insert(a);
								dcmobilepanel.insert(qaDiv);
								if('dcmmobile' == getspecificdiscInfo('format','dcmmobile',selectedTitle).toLowerCase())
									showdcMobileCategory=true;
							}
						  }
						}
				})
				}	
		})
		
	}
});
	
}//end if

}


function onChangeWMVSupport()
{  
	selectedFormat = 'wmv';
	setFormat('wmv');
	//3/29/2010
	//$('wmv').setStyle({disabled:true}).addClassName('disabled');
	//$('itunes').setStyle({disabled:false}).removeClassName('disabled'); 
	$('wmv-faq-section').removeClassName('hidden');
	if(!$('itunes-faq-section').hasClassName('hidden'))
		$('itunes-faq-section').addClassName('hidden');
	if(!$('dcmanager-faq-section').hasClassName('hidden'))
		$('dcmanager-faq-section').addClassName('hidden');
	if(!$('dcmobile-faq-section').hasClassName('hidden'))
		$('dcmobile-faq-section').addClassName('hidden');
	//$('currentformat-tab').update('Your current platform');
	var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
	Event.observe(wmp, 'load', function(event){
		fixPNG(wmp);
	});
	//$('currentformat-tab').insert(wmp);
	
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(wmp);
    }
	/*
	selectedFormat = 'wmv';
	setFormat('wmv');
	
	$('wmv').setStyle({disabled:true}).addClassName('disabled');
	$('itunes').setStyle({disabled:false}).removeClassName('disabled'); 
	$('wmv-faq-section').removeClassName('hidden');
	if(!$('itunes-faq-section').hasClassName('hidden'))
		$('itunes-faq-section').addClassName('hidden');
	$('currentformat-tab').update('Your current platform');
	var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
	Event.observe(wmp, 'load', function(event){
		fixPNG(wmp);
	});
	$('currentformat-tab').insert(wmp);
	
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(wmp);
    }
    */
}

function onChangeITunesSupport()
{
	selectedFormat = 'itunes';
	setFormat('itunes');
	//// 3/29/2010
	//$('itunes').setStyle({disabled:true}).addClassName('disabled');
	//$('wmv').setStyle({disabled:false}).removeClassName('disabled');
	$('itunes-faq-section').removeClassName('hidden');
	if(!$('wmv-faq-section').hasClassName('hidden'))
		$('wmv-faq-section').addClassName('hidden');
	if(!$('dcmanager-faq-section').hasClassName('hidden'))
		$('dcmanager-faq-section').addClassName('hidden');
	if(!$('dcmobile-faq-section').hasClassName('hidden'))
		$('dcmobile-faq-section').addClassName('hidden');
	
	//$('currentformat-tab').update('Your current platform');
	var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
	Event.observe(itun, 'load', function(event){
		fixPNG(itun);
	});
	//$('currentformat-tab').insert(itun);
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(itun);
    }
	/*
	selectedFormat = 'itunes';
	setFormat('itunes');
	
	$('itunes').setStyle({disabled:true}).addClassName('disabled');
	$('wmv').setStyle({disabled:false}).removeClassName('disabled');
	$('itunes-faq-section').removeClassName('hidden');
	if(!$('wmv-faq-section').hasClassName('hidden'))
		$('wmv-faq-section').addClassName('hidden');
	$('currentformat-tab').update('Your current platform');
	var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
	Event.observe(itun, 'load', function(event){
		fixPNG(itun);
	});
	$('currentformat-tab').insert(itun);
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
    {
	fixPNG(itun);
    }
	*/
}

function onChangedcManagerSupport(){
	selectedFormat = 'dcmanager';
	setFormat('dcmanager');
	
	$('dcmanager-faq-section').removeClassName('hidden');
	if(!$('wmv-faq-section').hasClassName('hidden'))
		$('wmv-faq-section').addClassName('hidden');
	if(!$('itunes-faq-section').hasClassName('hidden'))
		$('itunes-faq-section').addClassName('hidden');
	if(!$('dcmobile-faq-section').hasClassName('hidden'))
		$('dcmobile-faq-section').addClassName('hidden');
	
	
}

function onChangedcMobileSupport(){
	selectedFormat = 'dcmobile';
	setFormat('dcmobile');
	
	$('dcmobile-faq-section').removeClassName('hidden');
	if(!$('wmv-faq-section').hasClassName('hidden'))
		$('wmv-faq-section').addClassName('hidden');
	if(!$('itunes-faq-section').hasClassName('hidden'))
		$('itunes-faq-section').addClassName('hidden');
	if(!$('dcmanager-faq-section').hasClassName('hidden'))
		$('dcmanager-faq-section').addClassName('hidden');
	
	
}
/**
 * This method shows the iTunes tab in support page.
 * @param itunesCategoryNum
 * @return
 */
function showItunesSupport(itunesCategoryNum)
{
	
	if(itunesCategoryNum == 0)
	{
		$('itunes').hide();
		/*if($('itunesdiv') != null)
		{
			$('itunesdiv').hide();
			$('wmvdiv').setStyle({width:'155px'});
			$('wmv').setStyle({align:'center'});
		}*/
		/*if($('changeformat-tab') != null)
			$('changeformat-tab').hide();
		$('currentformat-tab').update('Your current platform');//no change
		var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
		Event.observe(wmp, 'load', function(event){
			fixPNG(wmp);
		});
		$('currentformat-tab').insert(wmp);
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(wmp);
	    }
		*/
		
		
	}
	else
	{
		/*// removed as of 3/29/2010
		$('itunes').setStyle({disabled:true}).addClassName('disabled');
		$('wmv').setStyle({disabled:false}).removeClassName('disabled');
		$('itunes-faq-section').removeClassName('hidden');
		if(!$('wmv-faq-section').hasClassName('hidden')){
			$('wmv-faq-section').addClassName('hidden');
			$('currentformat-tab').update('Your current platform');
			var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
			Event.observe(itun, 'load', function(event){
				fixPNG(itun);
			});
			$('currentformat-tab').insert(itun);
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {
			fixPNG(itun);
		    }
		}
		*/
	}
}

/**
 * This method shows the Windows tab in support page.
 * @param wmvCategoryNum
 * @return
 */
function showWMVSupport(wmvCategoryNum)
{
	
	if(wmvCategoryNum == 0)
	{
		
		$('wmv').hide();
		/*if($('wmvdiv') != null)
		{
			$('wmvdiv').hide();
			$('itunesdiv').setStyle({width:'155px'});
			$('itunes').setStyle({align:'center'});
		}*/
		/*if($('changeformat-tab') != null)
			$('changeformat-tab').hide();
		$('currentformat-tab').update('Your current platform'); //no change
		var itun = new Element('img',{src: 'images/common/logo_itunes.png',width:'64px',height:'64px',id:'itunes_logo'}).addClassName('tab');
		Event.observe(itun, 'load', function(event){
			fixPNG(itun);
		});
		$('currentformat-tab').insert(itun);
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	    {
		fixPNG(itun);
	    }
		*/
		
	}
	else
	{
		/*//removed as of 3/29/2010
		$('wmv').setStyle({disabled:true}).addClassName('disabled');
		$('itunes').setStyle({disabled:false}).removeClassName('disabled');
		$('wmv-faq-section').removeClassName('hidden');
		if(!$('itunes-faq-section').hasClassName('hidden')){
			$('itunes-faq-section').addClassName('hidden');
			$('currentformat-tab').update('Your current platform');
			var wmp = new Element('img',{src: 'images/common/logo_wmp.png',width:'64px',height:'64px',border:'0',id:'wmp_logo'}).addClassName('tab');
			Event.observe(wmp, 'load', function(event){
				fixPNG(wmp);
			});
			$('currentformat-tab').insert(wmp);
			
			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		    {
			fixPNG(wmp);
		    }
		}
		*/
	}
}

/**
*	Build the Support Form section
*/
function buildECSupportForm() {
	log('****** buildECSupportForm')
	
	
	if (false) {
//		Support.loadXML(Support.xml);
	} else {
		
		selectedSection = "SupportForm";
		if(selectedSource == '' || selectedSource == undefined)
			selectedSource = 'EC';
		//sendInfoToOmniture(selectedSection);
		
		buildHash("support-form-content");
		
		// build support form container
		var supportDiv = new Element('div', {id: 'support-form-content',name:'support-form-content'});

		// build middle div containing the support faqs
		var middleDiv = new Element('div', {id: 'middle'});
		supportDiv.insert(middleDiv);

		//build the form contents in a table
		var table=new Element('table').addClassName('support-form-table');
		var tBody = new Element('tbody',{});
		
		//build rows for Online Special Features section
		var heading1=new Element('div',{id: 'support-form-heading'}).addClassName('support-form-heading').update('Online Special Features');
		var dvdtitlecombo=new Element('select',{id:'dvdtitle',position:'right'});
		
		var headRow1=new Element('tr');
		var headCol=new Element('td',{colSpan:2,align:'left'}).insert(heading1);
		headRow1.insert(headCol);
		var dvdTitleRow=new Element('tr');
		var dvdTitleLabel=new Element('td',{align:'right',width:'40%'}).update('DVD Title');
		var req = new Element('span').addClassName('required').update('*');
		var dvdTitleValue=new Element('td',{align:'left',width:'60%'}).update(dvdtitlecombo);
		dvdTitleLabel.insert(req);
		dvdTitleRow.insert(dvdTitleLabel);
		dvdTitleRow.insert(dvdTitleValue);
		tBody.insert(headRow1);
		tBody.insert(dvdTitleRow);
		table.insert(tBody);
		
		//build rows for Contact information section
		var heading2=new Element('div',{id: 'contact-information'}).addClassName('support-form-heading group').update('Contact Information');
		var fName=new Element('input',{type:'text',id: 'firstname'});
		var lName=new Element('input',{type:'text',id: 'lastname'});
		var email=new Element('input',{type:'text',id:'email'});
		var headRow2=new Element('tr',{colSpan:2,align:'left'}).insert(heading2);
		var fNameRow=new Element('tr');
		var fNameLabel=new Element('td',{align:'right'}).update('First Name');
		var fNameValue=new Element('td',{align:'left'}).update(fName);
		fNameRow.insert(fNameLabel);
		fNameRow.insert(fNameValue);
		var lNameRow=new Element('tr');
		var lNameLabel=new Element('td',{align:'right'}).update('Last Name');
		var lNameValue=new Element('td',{align:'left'}).update(lName);
		lNameRow.insert(lNameLabel);
		lNameRow.insert(lNameValue);
		var emailRow=new Element('tr');
		var emailLabel=new Element('td',{align:'right'}).update('Email Address');
		var req = new Element('span').addClassName('required').update('*');
		var emailValue=new Element('td',{align:'left'}).update(email);
		emailLabel.insert(req);
		emailRow.insert(emailLabel);
		emailRow.insert(emailValue);
		tBody.insert(headRow2);
		tBody.insert(fNameRow);
		tBody.insert(lNameRow);
		tBody.insert(emailRow);
		table.insert(tBody);
	
		//build	rows for PC System and Portable Media Device Information section	 
		var heading3=new Element('div',{id: 'device-information'}).addClassName('support-form-heading').update('PC System and Portable Media Device Information');
		var osCombo=new Element('select',{id:'os'});
		
		var wmpCombo=new Element('select',{id:'wmp'});
		var headRow3=new Element('tr');
		var headCol=new Element('td',{colSpan:2,align:'left'}).insert(heading3);
		headRow3.insert(headCol);
		var opSysRow=new Element('tr');
		var opSysLabel=new Element('td',{align:'right'}).update('Operating System');
		var req = new Element('span').addClassName('required').update('*');
		var opSysVal=new Element('td',{align:'left'}).update(osCombo);
		opSysLabel.insert(req);
		opSysRow.insert(opSysLabel);
		opSysRow.insert(opSysVal);
		var wmpRow=new Element('tr');
		var wmpLabel=new Element('td',{align:'right'}).update('Windows Media Player');
		var req = new Element('span').addClassName('required').update('*');
		var wmpValue=new Element('td',{align:'left'}).update(wmpCombo);
		wmpLabel.insert(req);
		wmpRow.insert(wmpLabel);
		wmpRow.insert(wmpValue);
		tBody.insert(headRow3);
		tBody.insert(opSysRow);
		tBody.insert(wmpRow);
		table.insert(tBody);

		//build rows for Support Request Description section
		var heading4=new Element('div',{id: 'support-request'}).addClassName('support-form-heading').update('Support Request Description');
		var reqTypeCombo=new Element('select',{id:'srt'});

		var commentsQuestions=new Element('textarea',{id:'comments'}).addClassName('comments');
		var headRow4=new Element('tr');
		var headCol=new Element('td',{colSpan:2,align:'left'}).insert(heading4);
		headRow4.insert(headCol);
		var supReqTypeRow=new Element('tr');
		var supReqTypeLabel=new Element('td',{align:'right'}).update('Support request Type');
		var req = new Element('span').addClassName('required').update('*');
		var supReqTypeValue=new Element('td',{align:'left'}).update(reqTypeCombo);
		supReqTypeLabel.insert(req);
		supReqTypeRow.insert(supReqTypeLabel);
		supReqTypeRow.insert(supReqTypeValue);
		var commentsRow=new Element('tr');
		var commentsLabel=new Element('td',{align:'right'}).update('Comments or Questions');
		var req = new Element('span').addClassName('required').update('*');
		var commentsValue=new Element('td',{align:'left'}).update(commentsQuestions);
		commentsLabel.insert(req);
		commentsRow.insert(commentsLabel);
		commentsRow.insert(commentsValue);
		tBody.insert(headRow4);
		tBody.insert(supReqTypeRow);
		tBody.insert(commentsRow);
		table.insert(tBody);
		
		//build rows for required and submit button
		var submitButton=new Element('button',{id:'submitbutton'}).update('Submit');
		var requiredRow=new Element('tr');
		var col=new Element('td');
		var required=new Element('td',{align:'left'}).update('*=Required').addClassName('support-form-required');
		requiredRow.insert(col);
		requiredRow.insert(required);
		var submitRow=new Element('tr');
		var col=new Element('td');
		var submit=new Element('td',{align:'left'}).update(submitButton);
		submitRow.insert(col);
		submitRow.insert(submit);
		tBody.insert(requiredRow);
		tBody.insert(submitRow);
		table.insert(tBody);
		
		middleDiv.insert(table);
		
		$('main-content').update(supportDiv);
		if($('submitbutton') != null)
		{
			$('submitbutton').observe('click', checkECSupportForm);
		}	
		
		// populate windows media player
		if($('wmp') != null)
		{
			//log('Data.wmp = ' + Data.wmp);
			$('wmp').update(new Element('option').update(Data.selectlabel[selectedLang].label));
			Data.wmp.each( function(item) {
				if (	(wmpversion.include("10") && item.include("10")) ||
					(wmpversion.include("11") && item.include("11")) ||
					(wmpversion.include("12") && item.include("12"))  )
					$('wmp').insert(new Element('option', {selected: 'true'}).update(item));
				else 
					$('wmp').insert(new Element('option').update(item));
			});	
			$('wmp').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));
			$('wmp').observe('change', function () {
				this.removeClassName('highlight');
			});
		}	
		
		log('build support form: os');
		// populate os list
		if($('os') != null)
		{
			$('os').update(new Element('option').update(Data.selectlabel[selectedLang].label));	
			var isOSSelected = false;
			Data.os.each( function(item) {
				// preselect the user's current os
				if( !isOSSelected &&
					(	(navigator.userAgent.include('Windows NT 5.1') && item.include('XP')) ||
						(navigator.userAgent.include('Windows NT 6.0') && item.include('Vista')) || 
						(navigator.userAgent.include('Mac') && item.include('Mac'))	)
					) {
					isOSSelected = true;
					$('os').insert(new Element('option', {selected: 'true'}).update(item));
				} else {
					$('os').insert(new Element('option').update(item));
				}
			});	
			$('os').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));	
			$('os').observe('change', function () {
				this.removeClassName('highlight');
			});
		}	
			// get support request type
		if($('srt') != null)
		{
			$('srt').update(new Element('option').update(Data.selectlabel[selectedLang].label));
			Data.srt[selectedLang].selections.each(function (item) {
				$('srt').insert(new Element('option', {value: item.id}).update(item.label));
			});
			$('srt').observe('change', function () {
				this.removeClassName('highlight');
			});
		}	
		
		if($('email') != null)
		{
			$('email').observe('keypress', function () {
				this.removeClassName('highlight');
//				$('cs-error').update();
			});
		}	
	
		if($('comments') != null)
		{
			$('comments').observe('keypress', function () {
				this.removeClassName('highlight');
//				$('cs-error').update();
			});	
		}	
		
		buildSectionTitle("SUPPORT");
		buildLanguageSelector();
		buildTitleMap();
		buildHeader();
		buildFooter();
		clearCountrySelector();
		clearUpdates();
	}	
}

function checkECSupportForm()
{ 
	var ref = this;
	
	log('comments:  '+$F('comments'));
	// email reqular expression
	var emailFormat = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if ($F('dvdtitle') == Data.selectlabel[selectedLang].label || $F('dvdtitle') ==null) {	
		$('dvdtitle').focus();
		$('dvdtitle').addClassName('highlight');
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if (!emailFormat.test($F('email')) || $F('email') ==null) {	
		$('email').focus();
		$('email').addClassName('highlight');
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('os') == Data.selectlabel[selectedLang].label || $F('os') ==null) {	
		$('os').focus();
		$('os').addClassName('highlight');
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('wmp') == Data.selectlabel[selectedLang].label || $F('wmp') ==null) {
		$('wmp').focus();
		$('wmp').addClassName('highlight');
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('srt') == Data.selectlabel[selectedLang].label || $F('srt') ==null) {
		$('srt').focus();
		$('srt').addClassName('highlight');		
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('comments') =='') {
		$('comments').focus();
		$('comments').addClassName('highlight');		
		alert(Data.requesterror[selectedLang].fillrequiredfields);
	}else
	{
		log('DVD TITLE - EC SUPPORT FORM: '+$F('dvdtitle'));
		// send info to omniture
		var omniVars = new Object();
		clearOmnitureParams(omniVars);
		var formatOmniture = '';
		omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
		omniVars.channel =  "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;;
		omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+selectedSection;
		omniVars.prop5 = userID; 
		omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle($F('dvdtitle'))+": "+getDiscEdition($F('dvdtitle'));
		omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource($F('dvdtitle'));
		if(getDiscFormat($F('dvdtitle'),'WMV') != '')
		{
			if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
			{
				formatOmniture = getDiscFormat($F('dvdtitle'),'WMV')+" and "+getDiscFormat($F('dvdtitle'),'iTunes');
			}
			else
			{
				formatOmniture = getDiscFormat($F('dvdtitle'),'WMV');
			}
		}
		else
		{
			if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
			{
				formatOmniture = getDiscFormat($F('dvdtitle'),'iTunes');
			}
		}
		omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('wmp');
		
		doOmnitureTrackData(omniVars);
				
		var selectedVendorEmail = Data.getProviderEmail(getDiscProvider($F('dvdtitle')));
		log("selected Title's SKU: " + $F('dvdtitle'));
		log("selectedTitle: " + getDiscTitle($F('dvdtitle')));
		log("selectedVendorEmail: " + selectedVendorEmail);
		log("selectedVendor: " + getDiscProvider($F('dvdtitle')));	
		var selectedCountryConversion = formcountryConversion(selectedCountry);
		var emailData = {sender: $F('email'),
		recipient: selectedVendorEmail,
		subject: 'Online Special Features Support Request',
		type: 'customerSupport',
		disctitle: getDiscTitle($F('dvdtitle')),
		firstname: $F('firstname'),
		lastname: $F('lastname'),
		emailaddress: $F('email'),
		os: $F('os'),
		wmp: $F('wmp'),
		problemtype: $F('srt'),
		description: $F('comments'),
		mediaplayer: "",
		isLoyaltyRequest:false,
		dcRequestType:"other",
		country:selectedCountryConversion,
		srt:$F('srt'),
		mediaformat:getDiscFormat($F('dvdtitle'))
	}
		RequestForm.loadXML(emailData);
	}
}

/**
*	Build the Support Form section
*/
function buildSupportForm1() {
	log('buildSupportForm1 selected Lang: '+SupportForm.language);
	
	//if the TitleMap is not loaded then load it
	if ((SupportForm.language == undefined || SupportForm.language != selectedLang))
	{
		loadSupportForm();
	}else {
		
		selectedSection = "SupportForm";
		
//		sendInfoToOmniture(selectedSection);
		if(inApp=='true'&& inAppAuthCode!=null)
		{	buildHash("supportform-content&inapp=true&code="+inAppAuthCode);
		   
		
		}
		else
		{
			    if(document.location.hash.include("inapp"))
				buildHash("supportform-content&inapp=true&code="+authorizationCode);
				else buildHash("supportform-content");
			positionMainContent(selectedSection);
		}
		
		
		requiredInfoRedirect = "SupportForm";
		// build support form container
		var supportDiv = new Element('div', {id: 'supportform-content', name:'supportform-content'});

		// build middle div 
		var middleDiv = new Element('div', {id: 'middle'}).addClassName('middle');
		
		var suppForm = new Element('form',{id:'csform'});
		var csEntry= new Element('div',{id:'cs-entry'});
		var headingDiv = new Element('div').addClassName('group');
		var heading = new Element('span',{id:'form-label'}).addClassName('txt-label').update(SupportForm.label);
		headingDiv.insert(heading);
		csEntry.insert(headingDiv);
		
		//build Support request Type(srt) group
		if(SupportForm.getTextLabel('srt') != '')
		{
			var srtDiv = new Element('div').addClassName('group');
			var srtLabel = new Element('span',{id:'srt-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var srtCombo=new Element('select',{id:'srt'});
			srtDiv.insert(srtLabel);
			srtLabel.insert(req);
			srtDiv.insert(srtCombo);
			csEntry.insert(srtDiv);
		}
		
		//build DVD Title group
		if(SupportForm.getTextLabel('title') != '')
		{
			var dvdTitleDiv = new Element('div').addClassName('group');
			var dvdTitleLabel = new Element('span',{id:'dvdtitle-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var dvdTitleCombo=new Element('select',{id:'dvdtitle'});
			dvdTitleDiv.insert(dvdTitleLabel);
			dvdTitleLabel.insert(req);
			dvdTitleDiv.insert(dvdTitleCombo);
			csEntry.insert(dvdTitleDiv);
		}	
		//build...Do you have authorization code group
		if(SupportForm.getTextLabel('authradiolabel') != '')
		{
			var authDiv = new Element('div').addClassName('group');
			var authRadioLabel = new Element('span',{id:'authradiolabel'}).addClassName('radio-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			if(showAuthCode == "false")
			{
				var yesRadio = new Element('input',{type:'radio',name:'authradio',value:'true',id:'authYes'});
				var noRadio = new Element('input',{type:'radio',name:'authradio',value:'false',checked:'true',defaultChecked:'true',id:'authNo'});
			}	
			else
			{
				var yesRadio = new Element('input',{type:'radio',name:'authradio',value:'true',defaultChecked:'true',checked:'true',id:'authYes'});
				var noRadio = new Element('input',{type:'radio',name:'authradio',value:'false',id:'authNo'});
			}
			var yesLabel = new Element('span',{id:'yesauth-label'}).update('Yes');
			var noLabel = new Element('span',{id:'noauth-label'}).update('No');
			authRadioLabel.insert(req);
			authDiv.insert(authRadioLabel);
			authDiv.insert(yesRadio);
			authDiv.insert(yesLabel);
			authDiv.insert(noRadio);
			authDiv.insert(noLabel);
			csEntry.insert(authDiv);
		}
		//build Authorization Code group
		if(SupportForm.getTextLabel('authcode') != '' )
		{
			var authCodeDiv = new Element('div',{id:'authCodeDiv'}).addClassName('group');
			var authCodeLabel = new Element('span',{id:'authcode-label'}).addClassName('dd-label').update(SupportForm.label);
			var authCodeCombo=new Element('input',{id:'authcode',type:'text'});
			var req = new Element('span').addClassName('required').update('*');
			authCodeLabel.insert(req);
			authCodeDiv.insert(authCodeLabel);
			authCodeDiv.insert(authCodeCombo);
			csEntry.insert(authCodeDiv);
		}
		
		//build Media Type group
		if(SupportForm.getTextLabel('mediatype') != '')
		{
			var mediaTypeDiv = new Element('div').addClassName('group');
			var mediaTypeLabel = new Element('span',{id:'mediatype-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var mediaTypeCombo=new Element('select',{id:'mediatype'});
			mediaTypeDiv.insert(mediaTypeLabel);
			mediaTypeLabel.insert(req);
			mediaTypeDiv.insert(mediaTypeCombo);
			csEntry.insert(mediaTypeDiv);
		}
		
		//build Operating System group
		if(SupportForm.getTextLabel('os') != '')
		{
			var osDiv = new Element('div').addClassName('group');
			var osLabel = new Element('span',{id:'os-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var osCombo=new Element('select',{id:'os'});
			osDiv.insert(osLabel);
			osLabel.insert(req);
			osDiv.insert(osCombo);
			csEntry.insert(osDiv);
		}	

		
		
		//build Media Player group
		if(SupportForm.getTextLabel('wmp') != '')
		{
			var wmpDiv = new Element('div').addClassName('group');
			var wmpLabel = new Element('span',{id:'wmp-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var wmpCombo=new Element('select',{id:'wmp'});
			wmpDiv.insert(wmpLabel);
			wmpLabel.insert(req);
			wmpDiv.insert(wmpCombo);
			csEntry.insert(wmpDiv);
		}	
	
		//build Portable Media Device Manufacturer(pmdm) group
		if(SupportForm.getTextLabel('pmdm') != '')
		{
			var pmdmDiv = new Element('div').addClassName('group');
			var pmdmLabel = new Element('span',{id:'pmdm-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var pmdmCombo=new Element('select',{id:'pmdm'});
			pmdmDiv.insert(pmdmLabel);
			pmdmLabel.insert(req);
			pmdmDiv.insert(pmdmCombo);
			//3/30/2010 // needs lang support
			pmdmDiv.insert("&nbsp;&nbsp;<a href=\"#\" onclick=\"return openPhoneSelect()\">   Click here</a> if you don't see your phone");
			csEntry.insert(pmdmDiv);
		}	
		
		//build Portable Media Device(pmd) group
		if(SupportForm.getTextLabel('pmd') != '')
		{
			var pmdDiv = new Element('div').addClassName('group');
			var pmdLabel = new Element('span',{id:'pmd-label'}).addClassName('dd-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var pmdCombo=new Element('select',{id:'pmd'});
			pmdDiv.insert(pmdLabel);
			pmdLabel.insert(req);
			pmdDiv.insert(pmdCombo);
			csEntry.insert(pmdDiv);
		}	
		
		
		//build Are you using same computer....group
		if(SupportForm.getTextLabel('dccomplabel') != '')
		{
			var dcCompDiv = new Element('div').addClassName('group');
			var dcCompLabel = new Element('span',{id:'dccomplabel'}).addClassName('radio-label').update(SupportForm.label);
			var req = new Element('span').addClassName('required').update('*');
			var yesRadio = new Element('input',{type:'radio',name:'dccomp',value:'true',defaultChecked:'true',checked:'true'});
			var yesLabel = new Element('span',{id:'yesdcomp-label'}).update('Yes');
			var noRadio = new Element('input',{type:'radio',name:'dccomp',value:'false'});
			var noLabel = new Element('span',{id:'nodcomp-label'}).update('No');
			dcCompLabel.insert(req);
			dcCompDiv.insert(dcCompLabel);
			dcCompDiv.insert(yesRadio);
			dcCompDiv.insert(yesLabel);
			dcCompDiv.insert(noRadio);
			dcCompDiv.insert(noLabel);
			csEntry.insert(dcCompDiv);
		}
		
		//build required label
		if(SupportForm.getTextLabel('required') != '')
		{
			var reqDiv = new Element('div');
			var reqLabel = new Element('span',{id:'req-label'}).addClassName('txt-label required').update(SupportForm.label);
			reqDiv.insert(reqLabel);
			csEntry.insert(reqDiv);
		}	
		
		//build next button
		if(SupportForm.getTextLabel('next') != '')
		{
			var nextDiv = new Element('div',{align:'center'});
			var nextLabel = new Element('input',{type:'button', id:'nextbutton',value:SupportForm.label});
			nextDiv.insert(nextLabel);
			csEntry.insert(nextDiv);
		}
		
		var faqContDiv = new Element('div',{id:'faq-content'}).addClassName('faq hidden');
		var faqPrevQNodeDiv = new Element('div',{id:'faq-prevqnode'});
		var arrowIcon = new Element('span').addClassName('arrow-icon');
		var faqPrevQNodeLabel= new Element('span',{id:'faq-prevqnode-label'}).update('PREVIOUS FAQ...');
		
		faqPrevQNodeDiv.insert(arrowIcon);
		faqPrevQNodeDiv.insert(faqPrevQNodeLabel);
		faqContDiv.insert(faqPrevQNodeDiv);
		
		//build faq question header
		var faqQuesHeaderDiv = new Element('div',{id:'faq-question-header'}).update('QUESTION:');
		faqContDiv.insert(faqQuesHeaderDiv);
		
		//build faq question container
		var faqQuesDiv = new Element('div',{id:'faq-question'}).update('[FAQ question goes here]');
		faqContDiv.insert(faqQuesDiv);
		
		//build faq answer header
		var faqAnsHeaderDiv = new Element('div',{id:'faq-answer-header'}).update('ANSWER:');
		faqContDiv.insert(faqAnsHeaderDiv);
		
		//build faq answer container
		var faqAnsDiv = new Element('div',{id:'faq-answer'}).update('[FAQ answer goes here]');
		faqContDiv.insert(faqAnsDiv);
		
		//build related faq questions header
		var faqRelQuesHeaderDiv = new Element('div',{id:'faq-qnodes-header'}).update('RELATED QUESTIONS:');
		faqContDiv.insert(faqRelQuesHeaderDiv);
		
		//build related faq questions container
		var faqRelQuesDiv = new Element('div',{id:'faq-qnodes'});
		faqContDiv.insert(faqRelQuesDiv);
		
		var faqPrevQNodeDiv = new Element('div',{id:'faq-prevqnode1'});
		var arrowIcon = new Element('span').addClassName('arrow-icon');
		var faqPrevQNodeLabel= new Element('span',{id:'faq-prevqnode-label1'}).update('PREVIOUS FAQ...');
		
		faqPrevQNodeDiv.insert(arrowIcon);
		faqPrevQNodeDiv.insert(faqPrevQNodeLabel);
		faqContDiv.insert(faqPrevQNodeDiv);
		
		suppForm.insert(faqContDiv);
		
		//build faq resolve section
		var faqResolveDiv = new Element('div',{id:'faq-resolve'}).addClassName('hidden');
		var faqResolveLabel = new Element('div',{id:'resolve-label'}).update('Did this information help resolve your problem?');
		var buttonDiv = new Element('div');
		var yesButton = new Element('input',{type:'button', id:'yesbutton',value:'Yes'});
		var noButton = new Element('input',{type:'button', id:'nobuttonfaq',value:'No'});
		buttonDiv.insert(yesButton);
		buttonDiv.insert(noButton);
		faqResolveDiv.insert(faqResolveLabel);
		faqResolveDiv.insert(buttonDiv);
		suppForm.insert(faqResolveDiv);
		
		//build thankyou section
		var thankUDiv = new Element('div',{id:'cs-thankyou'}).addClassName('hidden');
		var thankULabel = new Element('div',{id:'thankyou-label'}).update('Thank you for using the support site');
		thankUDiv.insert(thankULabel);
		
		var csReqDiv = new Element('div',{id:'cs-request'}).addClassName('hidden');
		
		//build first name
		var fNameDiv = new Element('div').addClassName('group');
		var fNameLabel = new Element('span',{id:'firstname-label'}).addClassName('dd-label').update('First Name:');
		var req = new Element('span').addClassName('required').update('*');
		var fName = new Element('input',{type:'text',id:'firstname'});
		fNameLabel.insert(req);
		fNameDiv.insert(fNameLabel);
		fNameDiv.insert(fName);
		
		//build last name
		var lNameDiv = new Element('div').addClassName('group');
		var lNameLabel = new Element('span',{id:'lastname-label'}).addClassName('dd-label').update('Last Name:');
		var lreq = new Element('span').addClassName('required').update('*');
		var lName = new Element('input',{type:'text',id:'lastname'});
		lNameLabel.insert(lreq);
		lNameDiv.insert(lNameLabel);
		lNameDiv.insert(lName);
		
		//build email address
		var emailDiv = new Element('div').addClassName('group');
		var emailLabel = new Element('span',{id:'email-label'}).addClassName('dd-label').update('Email Address:');
		var req = new Element('span').addClassName('required').update('*');
		var email = new Element('input',{type:'text',id:'email'});
		emailLabel.insert(req);
		emailDiv.insert(emailLabel);
		emailDiv.insert(email);
		
		//build comments and questions
		var commentsDiv = new Element('div').addClassName('group');
		var commentsLabel = new Element('span',{id:'comments-label'}).addClassName('dd-label').update('First Name:');
		var req = new Element('span').addClassName('required').update('*');
		var comments = new Element('textarea',{id:'comments',rows:'3',cols:'17',wrap:'soft'}).setStyle({overflow:'auto'});//.setStyle({height:'40px','overflow-y':'auto', 'overflow-x':'hidden'});
		commentsLabel.insert(req);
		commentsDiv.insert(commentsLabel);
		commentsDiv.insert(comments);
		
		//build required label
		var reqDiv = new Element('div').addClassName('group');
		var reqLabel2 = new Element('span',{id:'req-label2'}).addClassName('txt-label required').update('*required');
		reqDiv.insert(reqLabel2);
		
		//build next button
		var submitDiv = new Element('div',{align:'center'}).addClassName('group');
		var submitLabel = new Element('input',{type:'button', id:'submitrequestbutton',value:'Submit'});
		submitDiv.insert(submitLabel);
		
		var errorDiv = new Element('div',{align:'center'}).addClassName('group');
		var error = new Element('div',{id:'cs-error'}).addClassName('required');
		errorDiv.insert(error);
		
		csReqDiv.insert(fNameDiv);
		csReqDiv.insert(lNameDiv);
		csReqDiv.insert(emailDiv);
		csReqDiv.insert(commentsDiv);
		csReqDiv.insert(reqDiv);
		csReqDiv.insert(submitDiv);
		csReqDiv.insert(errorDiv);
		
		suppForm.insert(csReqDiv);
		suppForm.insert(thankUDiv);
		suppForm.insert(csEntry);
		supportDiv.insert(middleDiv);
		middleDiv.insert(suppForm);
		//$('main-content').update(supportDiv);
		
		
		if(inApp == 'true')
		{
			//$('bounding-area').update($('main-content'));
			var body = document.getElementsByTagName("body");
			//body[0].style.backgroundColor ="transparent";
			///$('bounding-area').update(supportDiv);
			///$('bounding-area').setStyle({width:"540px",height:"370px"});
			///$('copyright').update();
			///$('anchor').update();
		
		 
			$('main-content').update(supportDiv);
			buildLanguageSelector(SupportForm);
		
		
		
		}
		else{
		inApp = null;
		$('main-content').update(supportDiv);
		buildLanguageSelector(SupportForm);
		}
		buildSupportForm();
		clearCountrySelector();
		clearUpdates();
		buildStoredInfo();
		buildHeader();
		buildFooter();
		buildSectionTitle(SupportForm);
		if($('feedback-button') != null)
			$('feedback-button').addClassName('sectionselect');
	}	
}

/** 
*	Displays the Support Form
*/
function loadSupportForm()
{
	log('WARNING: Support Form not built because selectedSource is ' + selectedSource);
    
	if(selectedSource == false) {
		buildLandingPage();
		return;
	}
	
	if(selectedLang == null || selectedLang == '') selectedLang = 'en';		
	SupportForm.loadXML("data/supportform_" + selectedLang + ".xml");

	log('localize support form to ' + selectedLang + ", SupportForm.language = " + SupportForm.language);
}

/** 
*	Displays the Landing Page
*/
function loadLandingPage()
{
	if(selectedLang == null || selectedLang == '' || selectedLang == undefined)
		selectedLang = 'en';
	
	LandingPage.loadXML("data/landingpage_en.xml");
	buildLandingPage();
	log('localize Landing Page to ' + selectedLang + ", LandingPage.language = " + LandingPage.language);
}

/** 
*	Displays the Edit Title page
*/
function loadRequiredInfo()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
		
	RequiredInfo.loadXML("data/requiredinfo_" + selectedLang + ".xml");
	log('localize Required Info to ' + selectedLang + ", RequiredInfo.language = " + RequiredInfo.language);
}

/** 
*	Displays the Home section
*/
function loadHome()
{
	
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
		
	if(selectedSource == false)
	{	buildLandingPage(); }
	else if(selectedSource.include('DC'))
	{	Home.loadXML("data/homeDC_" + selectedLang + ".xml");}
	else
		{Home.loadXML("data/homeEC_" + selectedLang + ".xml");}
	log('localize Home page to ' + selectedLang + ", Home.language = " + Home.language);
}

/** 
*	Displays the PIDHome questions 
*/
function loadPIDHome()
{

	PIDHome.loadXML("data/homePID.xml");
	
}

/** 
*	Displays the Getting Started section
*/
function loadGettingStarted()
{	
	
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	if(selectedSource == false || selectedTitle == '')
		{buildLandingPage();}	
	else	
		GettingStarted.loadXML("data/gettingstarted_" + selectedLang + ".xml");
		
	  log('localize Getting Started to ' + selectedLang + ", GettingStarted.language = " + GettingStarted.language);
}

/** 
*	Displays the Feedback Form section
*/
function loadFeedbackForm()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	
	//if(document.location.hash.include("inapp"))
	//{FeedbackForm.loadXML("data/feedbackform_" + selectedLang + ".xml");}
	if(selectedSource == false || selectedTitle == '')
		buildLandingPage();	
	else		
		FeedbackForm.loadXML("data/feedbackform_" + selectedLang + ".xml");
	log('localize FeedbackForm to ' + selectedLang + ", FeedbackForm.language = " + FeedbackForm.language);
}

/** 
*	Displays the Terms of Use section
*/
function loadTermsOfUse()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	if(selectedSource == false && selectedCountry == false)
		buildLandingPage();	
	else	
		TermsOfUse.loadXML("data/terms_" + selectedCountry + ".xml");
	log('localize TermsOfUse to ' + selectedLang + ", TermsOfUse.language = " + TermsOfUse.language);
}

/** 
*	Displays the Privacy Policy section
*/
function loadPrivacyPolicy()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	if(selectedSource == false && selectedCountry == false)
		buildLandingPage();
	else		
		PrivacyPolicy.loadXML("data/privacy_" + selectedCountry + ".xml");
	log('localize PrivacyPolicy to ' + selectedLang + ", PrivacyPolicy.language = " + PrivacyPolicy.language);
}

function loadSupportFormEC()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	if(selectedSource == false)
		buildLandingPage();
	else	
		SupportFormEC.loadXML("data/supportformEC_.xml");
	log('localize SupportFormEC to ' + selectedLang + ", SupportFormEC.language = " + SupportFormEC.language);
}

/** 
*	Displays the Support section
*/
function loadSupport()
{
	if(selectedLang == null || selectedLang == '')
		selectedLang = 'en';
	if(selectedSource == false || selectedCountry == false || selectedTitle == '')
		buildLandingPage();
	if(selectedLang == 'no')
		Support.loadXML("/dvdsupport/stellent/support.jsp?language=nn&source="+selectedSource);
	if(selectedLang == 'es-mx')
		Support.loadXML("/dvdsupport/stellent/support.jsp?language=el&source="+selectedSource);
	else	
		Support.loadXML("/dvdsupport/stellent/support.jsp?language=" + selectedLang+'&source='+selectedSource);
		//Support.loadXML("mydata/testingFAQ.xml");
	log('localize Support to ' + selectedLang + ", Support.language = " + Support.language);
}

/** 
*	Builds the Support Form 
*/
function buildSupportForm() {
	
	var ref = this;
	log('build support form'+ showAuthCode);
	
	selectedSection = "SupportForm";

	if (isBrowserAcceptable()) {
		try{
			wmpversion = PlayerSDKVersion();
		}catch(e){
			wmpversion = "corrupt DRM store";
		}
		try{
			securityversion = SecurityComponentUpgrade();
		}catch(e){
			securityversion = "corrupt DRM store";				
		}
	}
	var requiredMark = new Element('span').update('*').addClassName('required');

	$('form-label').update(SupportForm.label)		

	// localize labels
	if($('dvdtitle-label') != null)
		$('dvdtitle-label').update(SupportForm.getTextLabel('title')).insert(new Element('span').update('*').addClassName('required'));
	if($('authradiolabel') != null)
		$('authradiolabel').update(SupportForm.getTextLabel('authradiolabel')).insert(new Element('span').update('*').addClassName('required'));
	if($('authcode-label') != null)
		$('authcode-label').update(SupportForm.getTextLabel('authcode')).insert(new Element('span').update('*').addClassName('required'));
	if($('mediatype-label') != null)
		$('mediatype-label').update(SupportForm.getTextLabel('mediatype')).insert(new Element('span').update('*').addClassName('required'));
	if($('os-label') != null)
		$('os-label').update(SupportForm.getTextLabel('os')).insert(new Element('span').update('*').addClassName('required'));
	if($('wmp-label') != null)
		$('wmp-label').update(SupportForm.getTextLabel('wmp')).insert(new Element('span').update('*').addClassName('required'));
	$('pmdm-label').update(SupportForm.getTextLabel('pmdm'));
	if($('pmd-label') != null)
		$('pmd-label').update(SupportForm.getTextLabel('pmd'));
	if($('srt-label') != null)
		$('srt-label').update(SupportForm.getTextLabel('srt')).insert(new Element('span').update('*').addClassName('required'));
	if($('dccomplabel') != null)
		$('dccomplabel').update(SupportForm.getTextLabel('dccomplabel')).insert(new Element('span').update('*').addClassName('required'));
	if($('nextbutton') != null)
		$('nextbutton').value = SupportForm.getTextLabel('next');
	if($('yesdcomp-label') != null)
		$('yesdcomp-label').update(SupportForm.getTextLabel('yesbutton'));
	if($('yesauth-label') != null)
		$('yesauth-label').update(SupportForm.getTextLabel('yesbutton'));
	if($('yesbutton') != null)
		$('yesbutton').value = SupportForm.getTextLabel('yesbutton');

	if($('nodcomp-label') != null)
		$('nodcomp-label').update(SupportForm.getTextLabel('nobutton'));
	if($('noauth-label') != null)
		$('noauth-label').update(SupportForm.getTextLabel('nobutton'));
	if($('nobutton') != null)
		$('nobutton').value = SupportForm.getTextLabel('nobutton');
	if($('nobuttonfaq') != null)
		$('nobuttonfaq').value = SupportForm.getTextLabel('nobuttonfaq');

	if($('req-label') != null)
		$('req-label').update(SupportForm.getTextLabel('required'));
	if($('req-label2') != null)
		$('req-label2').update(SupportForm.getTextLabel('required'));

	if($('firstname-label') != null)	
		$('firstname-label').update(SupportForm.getTextLabel('fname')).insert(new Element('span').update('*').addClassName('required'));
	if($('lastname-label') != null)
		$('lastname-label').update(SupportForm.getTextLabel('lname')).insert(new Element('span').update('*').addClassName('required'));
	if($('email-label') != null)
		$('email-label').update(SupportForm.getTextLabel('email')).insert(new Element('span').update('*').addClassName('required'));
	if($('comments-label') != null)
		$('comments-label').update(SupportForm.getTextLabel('comments')).insert(new Element('span').update('*').addClassName('required'));
	if($('submitrequestbutton') != null)
		$('submitrequestbutton').value = SupportForm.getTextLabel('submit');

	$('faq-answer-header').update(SupportForm.getTextLabel('answer'));
	$('faq-question-header').update(SupportForm.getTextLabel('question'));
	$('faq-qnodes-header').update(SupportForm.getTextLabel('relatedquestion'));
	$('faq-prevqnode-label').update(SupportForm.getTextLabel('previousfaq'));
	$('faq-prevqnode-label1').update(SupportForm.getTextLabel('previousfaq'));	

	buildTitleMap();

	log('build support form: auth code');
	
	if(showAuthCode == "false")
	{
		$('authCodeDiv').style.display='none';
	}	
	
	Event.observe($('authYes'),'click',function(){
		if($('authCodeDiv') != null)
		{
			$('authCodeDiv').style.display='block';
		}
	});
		Event.observe($('authNo'),'click',function(){
			if($('authCodeDiv') != null)
			{
				$('authCodeDiv').style.display='none';
			}
		});
		
	if($('authcode') != null)
	{
		if(inAppAuthCode != null && inApp == 'true')
			$('authcode').value=inAppAuthCode;
		    //authorizationCode=inAppAuthCode;
	     	inAppAuthCode = null;
	}
	
	
	if(authorizationCode != '' && authorizationCode != null )
	{	
		$('authcode').value=authorizationCode;
	}
	
	if($('dvdtitle') != null)
	{  
		if((selectedTitle != null && inApp == 'true') ||(selectedTitle != null && document.location.hash.include("inapp") ))
		{
			if(BrowserDetect.browser == "Explorer")
			{    $('dvdtitle').update();
				 var dvdbox = document.getElementById('dvdtitle');
				 var dvdOpt = document.createElement('option');
			         dvdOpt.text = getDiscTitle(selectedTitle)+" ("+getDiscEdition(selectedTitle)+")";
			         //dvdOpt.text = 'Testing update';
				 	 dvdOpt.value=selectedTitle;
			         dvdbox.add(dvdOpt);
			         
			}
			else{			
				$('dvdtitle').update();
				$('dvdtitle').update(new Element('option', {value: selectedTitle}).update(getDiscTitle(selectedTitle)+" ("+getDiscEdition(selectedTitle)+")"));
			}
		}
	}
	
	log('build support form: media type');
	$('mediatype').observe('change', function () {
		this.removeClassName('highlight');
	});
	log('build support form: os');
	// populate os list
	if($('os') != null)
	{
		if(BrowserDetect.browser == "Explorer")
		{    
			 var osbox = document.getElementById('os');
			 var osOpt = document.createElement('option');
		         osOpt.text = Data.selectlabel[selectedLang].label;
		         osOpt.value='';
		         osbox.add(osOpt);
		         
		}
	 else $('os').update(new Element('option').update(Data.selectlabel[selectedLang].label));	
		var isOSSelected = false;
		Data.os.each( function(item) {
			// preselect the user's current os
			if( !isOSSelected &&
				(	(navigator.userAgent.include('Windows NT 5.1') && item.include('XP')) ||
					(navigator.userAgent.include('Windows NT 6.0') && item.include('Vista')) ||
					(navigator.userAgent.include('Windows NT 6.1') && item.include('7')) ||
					(navigator.userAgent.include('Mac') && item.include('Mac'))	)
				) {
				isOSSelected = true;
				$('os').insert(new Element('option', {selected: 'true'}).update(item));
			} else {
				$('os').insert(new Element('option').update(item));
			}
		});	
		$('os').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));	
		$('os').observe('change', function () {
			this.removeClassName('highlight');
		});
	}
	
	log('build support form: windows media player');
	// populate windows media player
	if($('wmp') != null && $F('mediatype') != null  && $F('os') != Data.selectlabel[selectedLang].label && $F('mediatype') != Data.selectlabel[selectedLang].label)
	{
		updateMediaPlayer();
		$('os').observe('change', function () {
				updateMediaPlayer();
			});
		$('mediatype').observe('change', function () {
			updateMediaPlayer();
		});
		
	}
	
	/* deep link without discID support $F('mediatype') will be null preventing required field media player from being updated
	 * so manually insert Other so that users can submit the form*/
	if($F('mediatype') == null){
		$('wmp').insert(new Element('option', {selected: 'true'}).update('Windows Media'));
		$('wmp').insert(new Element('option', {selected: 'true'}).update('iTunes'));
		$('wmp').insert(new Element('option', {selected: 'true'}).update('Other'));
	}
	
	log('build support form: pmdm');
	// populate portable media device manufacturer
	if($('pmdm') != null)
	{
		if(BrowserDetect.browser == "Explorer")
		{    
			 var pmdmbox = document.getElementById('pmdm');
			 var pmdmOpt = document.createElement('option');
		         pmdmOpt.text = Data.selectlabel[selectedLang].label;
		         pmdmOpt.value='';
		         pmdmbox.add(pmdmOpt);
		         
		}
		else $('pmdm').update(new Element('option').update(Data.selectlabel[selectedLang].label));
		Data.pmdm.each( function(item) {
			$('pmdm').insert(new Element('option').update(item.manufacturer));
			// get the first option
		});	
		$('pmdm').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));
		$('pmdm').observe('change', function () {
			this.removeClassName('highlight');
		});
	}	
	
	// change the device list
	if($('pmdm') != null && $('pmd') != null)
	{
		$('pmd').update();
		$('pmdm').observe('change', function () {
		$('pmd').update();
		Data.pmdm.each(function (item) {
			if (item.manufacturer == $F('pmdm')) {
				item.devices.each(function(subitem) {
					$('pmd').insert(new Element('option').update(subitem));
				});
				return false;
			}
		});	
		
		
		//alert($F('pmdm') +"  "+ incallBack($F('pmdm'))  );
		if( $F('pmdm')  ==   findPhoneManufacturer( $F('pmdm') )  )
		{	   
			$('pmd').update();
			
			for(var j=0; phoneArray.length; j++)
			{
				//alert(phoneArray[0].cns);
				if($F('pmdm') == phoneArray[j].cns)
				{
					//alert("in here"+phoneArray[j].pmodel );
					$('pmd').insert(new Element('option').update(phoneArray[j].pmodel));
					break;
				}
			}
			
			
		}
		
		$('pmd').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));

		$('pmd').setStyle({width:"auto"});	
		log('build support form: pmd');
		});
	}	
	
	log('build support form: srt '+selectedLang);
	// get support request type
	
	if($('srt') != null)
	{
		if(BrowserDetect.browser == "Explorer")
		{    var srtbox = document.getElementById('srt');
			 var firstOpt = document.createElement('option');
		        firstOpt.text = Data.selectlabel[selectedLang].label;
		        firstOpt.value= Data.selectlabel[selectedLang].label;
		        srtbox.add(firstOpt);
		}
		else{
				$('srt').update(new Element('option').update(Data.selectlabel[selectedLang].label));
			}
				Data.srt[selectedLang].selections.each(function (item) {
				$('srt').insert(new Element('option', {value: item.id}).update(item.label));
				});
				$('srt').observe('change', function () {
					this.removeClassName('highlight');
				});
		    
	}	
	
	// next button
	if($('nextbutton') != null)
	{
		$('nextbutton').observe('click', checkForm);
		
	}	
	
	// previous button
	if($('faq-prevqnode') != null)
	{
		$('faq-prevqnode').observe('click', function () {
//			if(faqCounter > 0)
//				faqCounter = faqCounter-1;
			showPreviousFAQ();
		});	
	}	
	
	// previous button
	if($('faq-prevqnode1') != null)
	{
		$('faq-prevqnode1').observe('click', function () {
//			if(faqCounter > 0)
//				faqCounter = faqCounter-1;
			showPreviousFAQ();
		});	
	}	
	
	// yes button
	if($('yesbutton') != null)
	{
		$('yesbutton').observe('click', function () {
			buildThankYou(1);
		});
	}	
	
	// no button
	if($('nobuttonfaq') != null)
	{
		$('nobuttonfaq').observe('click', buildRequestForm);
		
	}

	// clear first name
	if($('firstname') != null)
	{
		$('firstname').observe('keypress', function () {
			this.removeClassName('highlight');
			$('cs-error').update();
		});	
	}
	// clear error field
	if($('email') != null)
	{
		$('email').observe('keypress', function () {
			this.removeClassName('highlight');
			$('cs-error').update();
		});
	}	

	if($('comments') != null)
	{
		$('comments').observe('keypress', function () {
			this.removeClassName('highlight');
			$('cs-error').update();
		});	
	}	
	
	// submit reqest form
	if($('submitrequestbutton') != null)
	{	
		$('submitrequestbutton').observe('click', submitRequestForm);
	}	
	
	if($('cs-entry') != null)
	{
		$('cs-entry').show();
	}	
	
	log('building support form completed');
	removeLoadingPopup();
	
	//$('wmp').update(new Element('option', {selected: 'true'}).update('Other'));
}

/**
 * This method shows the previous FAQ (DCAIRS)
 * @return
 */
function showPreviousFAQ()
{
	// remove the last faq
	FAQ.list.pop();
	
	log("FAQ.list.length = " + FAQ.list.length);

	// show the form if there aren't any more FAQ to display		
	if (FAQ.list.length == 0)
	{
		$('cs-entry').show();
		$('faq-content').addClassName('hidden');
		$('faq-resolve').addClassName('hidden');
		if(inApp != 'true')
			buildLanguageSelector(SupportForm);
	} else
	{
		buildFAQ();
	}
}

function updateMediaPlayer()
{
	if(BrowserDetect.browser == "Explorer")
	{    var wmpbox = document.getElementById('wmp');
		 //var wmpOpt = document.createElement('option');
	}
	$('wmp').update();
	var mediaType = $F('mediatype').toLowerCase();
	var os = $F('os').toLowerCase();
	Data.wmp.each( function(item) {
		if(mediaType.include("wmv"))
		{
			if(os.include("xp"))
			{
				if (	(wmpversion.include("10") && item.include("10")) ||
						(wmpversion.include("11") && item.include("11")) ||
						(wmpversion.include("12") && item.include("12"))  )
						{
							if(BrowserDetect.browser == "Explorer")
							{
							var wmpOpt1 = document.createElement('option');
							wmpOpt1.text = item;
							wmpbox.add(wmpOpt1);
							}
							else $('wmp').insert(new Element('option', {selected: 'true'}).update(item));
						}
				else if((item.include("10")) ||
						(item.include("11")) ||
						(item.include("12")) )
					    { 	if(BrowserDetect.browser == "Explorer")
							{
					    	var wmpOpt2 = document.createElement('option');
							wmpOpt2.text = item;
					        wmpbox.add(wmpOpt2);
							}
					    	else $('wmp').insert(new Element('option').update(item));
					    }
			}
			else if(os.include("vista"))
			{
				if (	(wmpversion.include("11") && item.include("11")) ||
						(wmpversion.include("12") && item.include("12"))  )
						{
							if(BrowserDetect.browser == "Explorer")
							{   var wmpOpt3 = document.createElement('option');
								wmpOpt3.text = item;
								wmpbox.add(wmpOpt3);
							}
							else $('wmp').insert(new Element('option', {selected: 'true'}).update(item));
						}
				else if((item.include("11")) ||
						( item.include("12")) )
					    {
								if(BrowserDetect.browser == "Explorer")
								{   var wmpOpt4 = document.createElement('option');
									wmpOpt4.text = item;
									wmpbox.add(wmpOpt4);
								}
								else  $('wmp').insert(new Element('option').update(item));
					    }
			}else if(os.include("7"))
			{
				if (	(wmpversion.include("11") && item.include("11")) ||
						(wmpversion.include("12") && item.include("12"))  )
						{
							if(BrowserDetect.browser == "Explorer")
							{   var wmpOpt3 = document.createElement('option');
								wmpOpt3.text = item;
								wmpbox.add(wmpOpt3);
							}
							else $('wmp').insert(new Element('option', {selected: 'true'}).update(item));
						}
				else if((item.include("11")) ||
						( item.include("12")) )
					    {
								if(BrowserDetect.browser == "Explorer")
								{   var wmpOpt4 = document.createElement('option');
									wmpOpt4.text = item;
									wmpbox.add(wmpOpt4);
								}
								else  $('wmp').insert(new Element('option').update(item));
					    }
			}	
		}
		else if(mediaType.include("itunes"))
		{
			if(os.include("windows"))
			{
				if(item.include("7.6") || item.include("7.5"))
				{
					if(BrowserDetect.browser == "Explorer")
					{   var wmpOpt5 = document.createElement('option');
						wmpOpt5.text = item;
				        wmpbox.add(wmpOpt5);
					}
					else $('wmp').insert(new Element('option').update(item));
				}
			}
			else if(os.include("mac"))
			{
				if(item.include("7.6") || item.include("7.5"))
				{
					if(BrowserDetect.browser == "Explorer")
					{   var wmpOpt6 = document.createElement('option');
						wmpOpt6.text = item;
				        wmpbox.add(wmpOpt6);
					}
					else $('wmp').insert(new Element('option').update(item));
				}
			}
		}
		if(item.include("other"))
		{
			if(BrowserDetect.browser == "Explorer")
			{   var wmpOpt7 = document.createElement('option');
				wmpOpt7.text = item;
		        wmpbox.add(wmpOpt7);
			}
			else $('wmp').insert(new Element('option').update(item));
		}
	});	
	if(BrowserDetect.browser == "Explorer")
	{   var wmpOpt8 = document.createElement('option');
		wmpOpt8.text = Data.otherlabel[selectedLang].label;
        wmpbox.add(wmpOpt8);
	}
	else $('wmp').insert(new Element('option').insert(Data.otherlabel[selectedLang].label));
	
	
	$('wmp').observe('change', function () {
		this.removeClassName('highlight');
	});
	
}

/**
*	Builds form element from item
*/
function buildForm(item) {

	if (item.formtype.toLowerCase() == "text") {
	
		var label = new Element('div').addClassName('txt-label').update(item.label);
		
		if (item.id != undefined) label.addClassName(item.id);

	} else if (item.formtype.toLowerCase() == "dropdown") {
		var label = new Element('div').addClassName('dd-label').update(item.label);
		var req = new Element('span',{id:'required'}).addClassName('required').update('*');
		label.insert(req);
			
		if (item.id != undefined) {
			var input = new Element('select', {id: item.id}).addClassName('edit-title-combo');
		} else {
			var input = new Element('select');
		}

		if (item.id == "title") {
			input.insert(new Element('option').update(Data.selectlabel[selectedLang].label));
			// populate title dropdown with movies from title map
			TitleMap.list.each( function(item) {
				if (item.language == selectedLang)
				{
					var sel = new Element('option',{value:item.title}).update(item.title);
					input.insert(sel);
				}
			});		
		} else if (item.id == "pmdm") {
			// populate title dropdown with movies from title map
			Data.pmdm.each( function(item) {
				var sel = new Element('option').update(item.manufacturer);
				input.insert(sel);

			});		

		} else if (item.id == "mediatype") {
			// populate title dropdown with movies from title map
			Data.mediatype.each( function(item) {
				
				var sel = new Element('option').update(item);
				input.insert(sel);

			});	
		} else if (item.id == "os") {
			// populate title dropdown with movies from title map
			Data.os.each( function(item) {
				var sel = new Element('option').update(item);
				input.insert(sel);
			});		
		} else {
			item.selection.each( function(option) {
				var sel = new Element('option').update(option);
				input.insert(sel);

			});
		}
	} else if (item.formtype.toLowerCase() == "multibox") {
		var label = new Element('div').addClassName('mb-label').update(item.label);
		
		var input = new Element('input', {type: 'text'} );
		
	} else if (item.formtype.toLowerCase() == "textarea") {
		var label = new Element('div').addClassName('ta-label').update(item.label);
		
		if (item.id != undefined) {
			var input = new Element('textarea', {id: item.id, rows: '5', cols: '50'});
		} else {
			var input = new Element('textarea', {rows: '5', cols: '50'});

		}

	} else if (item.formtype.toLowerCase() == "submit") {
		var input = new Element('input', {type: 'submit', value:item.label} ).addClassName('submit').wrap('div', {align: 'center'});

	} else if (item.formtype.toLowerCase() == "reset") {
		var input = new Element('input', {type: 'reset', value:item.label} ).addClassName('reset').wrap('div', {align: 'center'});

	} else if (item.formtype.toLowerCase() == "button") {
		var input = new Element('input', {type: 'button', value:item.label} ).addClassName('button').wrap('div', {align: 'center'});

	}
	return new Element('div').addClassName('group').insert(label).insert(input);

}

/**
*	Check form before loading FAQ
*/
function checkForm() {
	log("checkForm");
	var ref = this;
	
	if ($F('dvdtitle') == Data.selectlabel[selectedLang].label || $F('dvdtitle') ==null) {	
		$('dvdtitle').focus();
		$('dvdtitle').addClassName('highlight');
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('mediatype') == Data.selectlabel[selectedLang].label || $F('mediatype') ==null) {	
		$('mediatype').focus();
		$('mediatype').addClassName('highlight');
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('os') == Data.selectlabel[selectedLang].label || $F('os') ==null) {	
		$('os').focus();
		$('os').addClassName('highlight');
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('wmp') == Data.selectlabel[selectedLang].label || $F('wmp') ==null) {
		$('wmp').focus();
		$('wmp').addClassName('highlight');
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($F('srt') == Data.selectlabel[selectedLang].label || $F('srt') ==null) {
		$('srt').focus();
		$('srt').addClassName('highlight');	
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else if ($('authCodeDiv').style.display != 'none' && $F('authcode') == '') {
		$('authcode').focus();
		$('authcode').addClassName('highlight');	
		if(selectedLang == "ja" && (BrowserDetect.browser == "Explorer"))
			modalWin(Data.requesterror[selectedLang].fillrequiredfields);
		else
		alert(Data.requesterror[selectedLang].fillrequiredfields);

	} else {
//		faqCounter = 0;
		setTitle($F('dvdtitle'));
		// send info to omniture
		var omniVars = new Object();
		var formatOmniture = '';
		omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS";
		omniVars.channel =  "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS";
		omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS";
		omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle($F('dvdtitle'))+": "+getDiscEdition($F('dvdtitle'));
		omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource($F('dvdtitle'));
		if(getDiscFormat(selectedTitle,'WMV') != '')
		{
			if(getDiscFormat(selectedTitle,'iTunes') != '')
			{
				formatOmniture = getDiscFormat(selectedTitle,'WMV')+" and "+getDiscFormat(selectedTitle,'iTunes');
			}
			else
			{
				formatOmniture = getDiscFormat(selectedTitle,'WMV');
			}
		}
		else
		{
			if(getDiscFormat(selectedTitle,'iTunes') != '')
			{
				formatOmniture = getDiscFormat(selectedTitle,'iTunes');
			}
		}
		omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('mediatype');
		omniVars.prop28 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('os')+" | "+$F('wmp')+" | "+$F('pmdm')+" | "+$F('pmd')+" | "+$F('srt');
		omniVars.prop29 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('srt');
		
		
		// send info to omniture
		if (BrowserDetect.browser == "Explorer") {
			omniVars.prop30 = navigator.userAgent;
			omniVars.prop31 = ref.wmpversion;
			omniVars.prop32 = ref.securityversion;
		}
		doOmnitureTrackData(omniVars);
//			var vendor = TitleMap.getVendor($F('dvdtitle'));
		
			Titlemap.list.each(function(item){
			var dId = '';
			item.list.each(function(arg){
				if(arg.discId == $F('dvdtitle'))
				{
					dId =  arg.discId;
					flag = true;
				}
			});	
			if(dId ==$F('dvdtitle')){
				var format = '';
				item.list.each(function(arg){
					if(arg.name != undefined)
					{
						//selectedTitle = arg.name;
						throw $break;
					}
				});
				item.country.each(function(c){
					if(c.id == selectedCountry)
					{
				c.formatArr.each(function(arg){
					if(arg.name != undefined && arg.name == $F('mediatype'))
					{
						format = arg.name;
					}
					if(arg.provider != undefined && format !='')
					{
						selectedVendor = arg.provider;
						selectedVendorEmail = Data.getProviderEmail(arg.provider);
						throw $break;
					}
				});
					}
				});
			}
		});
		isUsingComputerForDC =  Form.getInputs('csform','radio','dccomp').find(function(radio){ return radio.checked; }).value;	// $('csform').getInputs('radio', 'dccomp');
		
		log("selected Title's SKU: " + $F('dvdtitle')); 
		log("selectedTitle: " + getDiscTitle($F('dvdtitle')))
		log("selectedVendorEmail: " + selectedVendorEmail)
		log("selectedVendor: " + selectedVendor)		
		
		// SPECIAL CHECK: check if title is from CinemaNow
		if (selectedVendor.include("CINEMANOW")) {
			//if srt is Authorisation Code or Other then send mail to ADS
			/*if($F('srt') == "authorization_code" || $F('srt') == "other")
			{
				selectedVendorEmail = Data.getProviderEmail("ADS");
				log("selectedVendorEmail changed: " + selectedVendorEmail);
			}*/
			loadFAQ('cinemanow_'+selectedLang);
			
			
		}// SPECIAL CHECK: check for Speed Racer Blu-Ray for iTunes 
		else if ($F('dvdtitle') == '06126FE7-7572-46C6-ADE1-454F0EE39444' && $F('mediatype').include("iTunes")) {
			loadFAQ('speed_racer');
			
		} else {
			if (selectedVendor.include("APPLE")) {
				//if srt is Authorisation Code or Other then send mail to ADS
				if($F('srt') == "authorization_code" || $F('srt') == "other")
				{
					selectedVendorEmail = Data.getProviderEmail("ADS");
					log("selectedVendorEmail changed: " + selectedVendorEmail);
				}
				//document.location = itunesSupportURL;
				loadFAQ('FAQ_iTunes');
				}
				// check if the mediatype is iTunes and the vendor is APPLE	
				else if ($F('mediatype').include("iTunes") || selectedVendor.include("APPLE")) {
					// redirect to apple iTunes KB article
					//document.location = itunesSupportURL;
					loadFAQ('FAQ_iTunes');
		
				} else {
					
					// check if they are using the same computer for Digital Copy and it's IE
					if (selectedVendor.include("ADS") || selectedVendor.include("DELUX")) {
						if (isUsingComputerForDC == "true" && BrowserDetect.browser == "Explorer") {
							TestForUpgrades();
						} else {
							selectFAQ();
						}
					} else {
						document.location = cinemanowSupportURL;
					}
				}
		}
	}			
}

/**
*	Submits the request form
*/
function submitRequestForm(evt) {
	
	log('Submit Request Form');
	if($(evt.target).hasClassName('disabled')) {
		log('Button is disabled. Disallowing request.');
		return;
	}
	
	$(evt.target).addClassName('disabled');

	Data.srt[selectedLang].selections.each( function (item) {
		if ($F('srt') == item.id) selectedRequestType = item.label;
	});
	//temp - remove later
	var authCode = "";
	if($('authcode') != null)
	 authCode = $F('authcode');//$F('authcode');//+ '-' + $F('authcode2') + '-' + $F('authcode3') + '-' + $F('authcode4') + '-' + $F('authcode5');

	log('DVD SKU: ' + $F('dvdtitle'));
	log('DVD Title vendor: ' + selectedVendor );
	log('DVD Title email: ' + selectedVendorEmail );
	log('Media Type: ' + $F('mediatype'));
	log('O/S: ' + $F('os'));
	log('Windows Media Player: ' + $F('wmp'));
	log('Portable Media Device: ' + $F('pmd'));
	log('Portable Media Device Manufacturer: ' + $F('pmdm'));
	log('Is using same computer for Digital Copy?: ' + isUsingComputerForDC);
	log('Support Request Type: ' + selectedRequestType);
	log('Authorization Code: ' + authCode);
	log('First Name: ' + $F('firstname'));
	log('Last Name: ' + $F('lastname'));
	log('Email: ' + $F('email'));
	log('Comments: ' + $F('comments'));
		
	/*var selectedCountryConversion = formcountryConversion(selectedCountry); 
	
		var emailData =new Hash({
		recipient: selectedVendorEmail,
		authcode: authCode,
		type: 'customerSupport',
		disctitle: getDiscTitle(selectedTitle),
		firstname: $F('firstname'),
		lastname: $F('lastname'),
		emailaddress: $F('email'),
		os: $F('os'),
		wmp: $F('wmp'),
		pmdm: $F('pmdm'),
		pmd: $F('pmd'),
		description: $F('comments'),
		mediaformat: $F('mediatype'),
		samecomputer:isUsingComputerForDC,
		ie: getBrowser(),
		detectedos: getOS(),
		wmpversion:'wmpversion field',//wmpversion,
		securityversion:'security1982',//securityversion,
		country:selectedCountryConversion,
		discid:selectedTitle,
		edition:getDiscEdition(selectedTitle),
		isLoyaltyRequest:false,
		dcRequestType:selectedRequestType,
		source:selectedSource,
		language:selectedLang,
		srt:$F('srt')
	});*/
	discInfo = gatherSingleDiscInfo(selectedTitle);
	//alert($F('wmp') +"windows media player");
	//alert(paratureTranslate(isUsingComputerForDC)+ "using same pc?");
	var selectedCountryConversion = formcountryConversion(selectedCountry);
	
	
	
	
	var dropdownObj = [];
	dropdownObj.push({"id":"60" , "value":"797"});
	dropdownObj.push({"id":"24" , "value":"1"});
	dropdownObj.push({"id":"77" , "value":"122"});
	
	if(paratureTranslate(40,$F('mediatype'))!= "")
		dropdownObj.push({"id":"40","value":paratureTranslate(40,$F('mediatype'))});
	if(paratureTranslate(43,$F('pmdm')) != "")
			dropdownObj.push({"id":"43","value":paratureTranslate(43,$F('pmdm'))});
	if(paratureTranslate(70,isUsingComputerForDC) != "")
		dropdownObj.push({"id":"70","value":paratureTranslate(70,isUsingComputerForDC)});
	if(paratureTranslate(42,$F('wmp')) != "")
		dropdownObj.push({"id":"42","value":paratureTranslate(42,$F('wmp'))});
	if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) != "")
		dropdownObj.push({"id":"35","value":paratureTranslate(35,getspecificdiscInfo('gettitle', ''))});
	if(paratureTranslate(41,$F('os')) != "")
		dropdownObj.push({"id":"41","value":paratureTranslate(41,$F('os'))});
	if(paratureTranslate(34,$F('srt')) != "")
		dropdownObj.push( {"id":"34","value":paratureTranslate(34,$F('srt'))});
	if(paratureTranslate(67,getspecificdiscInfo('getedition', '')) != "")
		dropdownObj.push( {"id":"67","value":paratureTranslate(67,getspecificdiscInfo('getedition', ''))});
	if(paratureTranslate(62,selectedLang) != "")
		dropdownObj.push( {"id":"62" , "value":paratureTranslate(62,selectedLang)});
	if(paratureTranslate(61,getspecificdiscInfo('getsource', '')) != "")
		dropdownObj.push( {"id":"61" , "value":paratureTranslate(61,getspecificdiscInfo('getsource', ''))});
	if(paratureTranslate(32,selectedCountryConversion) != "")
		dropdownObj.push({"id":"32","value":paratureTranslate(32,selectedCountryConversion)});
	
	
	var entryFieldsObj = [];
	entryFieldsObj.push( {"id":"37","value":authCode});
	entryFieldsObj.push( {"id":"85","value":$F('os')});
	entryFieldsObj.push( {"id":"84","value":wmpversion});
	entryFieldsObj.push( {"id":"75","value":securityversion});
	entryFieldsObj.push( {"id":"72","value":getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle)});
	entryFieldsObj.push( {"id":"73","value":getBrowser()});
	entryFieldsObj.push( {"id":"74","value":getspecificdiscInfo('expire','date',selectedTitle)});
	var pmdParatureField = $F('pmd');
	
	if(pmdParatureField != null && pmdParatureField.include("AT&T"))
	{	var tmpParField = pmdParatureField.split(" ");
		if(tmpParField.length > 2)
		{		var restofParstr="";
				for(var i=1 ; i < tmpParField.length; i++)
				{
					restofParstr += " "+tmpParField[i];
				}
				pmdParatureField = "AT &amp; T " + restofParstr;
		}
		else{pmdParatureField = "AT &amp; T " + tmpParField[1];}
	}
	else{
	pmdParatureField = "";	
	}
	entryFieldsObj.push( {"id":"68","value":pmdParatureField});
	var commentsParatureField="";
	if($F('comments').include("&"))
	{	commentsParatureField = $F('comments');
		commentsParatureField = commentsParatureField.replace(/&/g, "&amp;"); }
	else{commentsParatureField = $F('comments');}
		
	entryFieldsObj.push( {"id":"28","value":commentsParatureField});
	entryFieldsObj.push( {"id":"66","value":selectedTitle});
	
	if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) == "")
	  entryFieldsObj.push( {"id":"65", "value":getspecificdiscInfo('gettitle', '')});
	entryFieldsObj.push( {"id":"27", "value":"WB Digital Copy Support - "+getspecificdiscInfo('gettitle', '') });
			
	var emailData = $H({
		"customDropDownFields":dropdownObj,
		"customEntryFields":entryFieldsObj,
		"departmentId":"15027",
		"email":$F('email'),
		"firstName":$F('firstname'),
		"lastName":$F('lastname'),
		"memeberOf":{"id":"33","value":"30"}
	}).toJSON();
	
	// email reqular expression
	var emailFormat = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	// some form validation
	if ($F('firstname').empty()) {
		$('cs-error').update(Data.requesterror[selectedLang].firstnamemissing);
		$('firstname').addClassName('highlight');
		$('firstname').focus();
		$(evt.target).removeClassName('disabled');
	}else if ($F('lastname').empty()) {
		$('cs-error').update(Data.requesterror[selectedLang].lastnamemissing);
		$('lastname').addClassName('highlight');
		$('lastname').focus();		
		$(evt.target).removeClassName('disabled');
	}  
	else if ($F('email').empty()) {
		$('cs-error').update(Data.requesterror[selectedLang].emailmissing);
		$('email').addClassName('highlight');
		$('email').focus();				
		$(evt.target).removeClassName('disabled');
	} else if (!emailFormat.test($F('email'))) {
		$('cs-error').update(Data.requesterror[selectedLang].emailinvalid);
		$('email').addClassName('highlight');
		$('email').focus();				
		$(evt.target).removeClassName('disabled');
	} else if ($F('comments').empty()) {
		$('cs-error').update(Data.requesterror[selectedLang].commentsmissing);
		$('comments').addClassName('highlight');
		$('comments').focus();				
		$(evt.target).removeClassName('disabled');
	} else {
		log('****************************************************');
		log('DISC TITLE: '+getDiscTitle(selectedTitle));
		$(evt.target).setValue('Please Wait...');
		
		
		RequestForm.loadXML(emailData, function() {
			$(evt.target).removeClassName('disabled');
			$(evt.target).setValue('Submit');
		});
		
	}
}

/**
*	Builds a single faq 
*/
function buildFAQ(arg) {
	log('buildFaq: arg = ' + arg + ', selectedLang = ' + selectedLang);
	
	var omniVars = new Object();
	//clearOmnitureParams(omniVars);
	omniVars.prop28 = '';
	var formatOmniture = '';
	omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS FAQ";
	omniVars.channel = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS FAQ";
	omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS FAQ";
	omniVars.prop5 = userID; 
	omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle($F('dvdtitle'))+": "+getDiscEdition($F('dvdtitle'));
	omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource($F('dvdtitle'));
	if(getDiscFormat($F('dvdtitle'),'WMV') != '')
	{
		if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
		{
			formatOmniture = getDiscFormat($F('dvdtitle'),'WMV')+" and "+getDiscFormat($F('dvdtitle'),'iTunes');
		}
		else
		{
			formatOmniture = getDiscFormat($F('dvdtitle'),'WMV');
		}
	}
	else
	{
		if(getDiscFormat($F('dvdtitle'),'iTunes') != '')
		{
			formatOmniture = getDiscFormat($F('dvdtitle'),'iTunes');
		}
	}
	omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+$F('mediatype');
	omniVars.prop34 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+FAQ.list.last().question;
	// show the faq div only
	$('cs-entry').hide();
	$('faq-content').removeClassName('hidden');
	$('faq-resolve').removeClassName('hidden');
	
//	if(faqCounter == 0)
//	{
//		$('faq-prevqnode').hide();
//		$('faq-prevqnode1').hide();
//	}
//	else
//	{
		$('faq-prevqnode').show();
		$('faq-prevqnode1').show();
//	}

	// display the question and answer
	$('faq-question').update(FAQ.list.last().question);

	$('faq-answer').update(FAQ.list.last().answer);

	$('faq-qnodes').update();

	if (FAQ.list.last().qnodes.size() > 0) 
		$('faq-qnodes-header').show();
	else 
		$('faq-qnodes-header').hide();

	$('resolve-label').update(SupportForm.getTextLabel('resolvelabel'));

	// display the qnode questions
	FAQ.list.last().qnodes.each(function(item) {

		var que = new Element('a').update(item.question);
		var qnodeQues = new Element('div',{id:'qNode'}).addClassName('question').update(que);

		Event.observe(qnodeQues, 'click', function () {
			omniVars.prop33 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+item.id+": "+$F('srt');
//			faqCounter = faqCounter+1;
			loadFAQ(item.id);			
		});
		Event.observe(que, 'mouseover', function () {
			que.addClassName('onhover');
		});
		Event.observe(que, 'mouseout', function () {
			que.removeClassName('onhover');
		});

		$('faq-qnodes').insert(qnodeQues);		
	});
	doOmnitureTrackData(omniVars);
	clearLanguageSelector();
}

/** 
*	Load the proper FAQ based on user's selection
*/
function loadFAQ(arg) {
	log('AUTH CODE: '+$F('authcode'));
	
	// check if the passed argument is a number then get the qnode by node id
	if (Number(arg) > 0) {
		FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language=' +  selectedLang +'&qnode=' + arg);
	} else {
		if(arg.toLowerCase() == "authorization_code")
		{	
			if(getPIDHUBCountry(selectedTitle, selectedCountry,'PID')==true)
			{	
				if($F('srt') == 'authorization_code')
					{ 			
							if($F('authcode') != '')
								{//FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=066138');
								//alert("There exist an authcode go here")
								FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=071860');
								}
							else{
								// check if the passed argument is a string then get the qnode by title id
								//FAQ.loadXML('/dvdsupport/stellent/Questionnode.jsp?language=' +  selectedLang + '&title=' + arg );
								//alert("no authcode exists go here");
								FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=071861');
								}
					}
			}
			else{
					if($F('authcode') != '')
						{//FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=066138');
						FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=069723');
						}
					else
						// check if the passed argument is a string then get the qnode by title id
						FAQ.loadXML('/dvdsupport/stellent/Questionnode.jsp?language=' +  selectedLang + '&title=' + arg );
					
					
					
				}
		}
		else{
		// check if the passed argument is a string then get the qnode by title id
		FAQ.loadXML('/dvdsupport/stellent/Questionnode.jsp?language=' +  selectedLang + '&title=' + arg );
		}
	
		
	}
	$('csform').scrollTo(0,0);
}
/*
 function loadFAQ(arg) {
	log('AUTH CODE: '+$F('authcode'));
	
	// check if the passed argument is a number then get the qnode by node id
	if (Number(arg) > 0) {
		FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language=' +  selectedLang +'&qnode=' + arg);
	} else {
		if(arg.toLowerCase() == "authorization_code")
		{
			if($F('authcode') != '')
				FAQ.loadXML('/dvdsupport/stellent/Getnode.jsp?language='+selectedLang+'&qnode=066138');
			else
				// check if the passed argument is a string then get the qnode by title id
				FAQ.loadXML('/dvdsupport/stellent/Questionnode.jsp?language=' +  selectedLang + '&title=' + arg );
			
		}	
		else{
			// check if the passed argument is a string then get the qnode by title id
			FAQ.loadXML('/dvdsupport/stellent/Questionnode.jsp?language=' +  selectedLang + '&title=' + arg );
		}
	}
	$('csform').scrollTo(0,0);
}
 */

/** 
*	Selects the proper FAQ based on user's selection
*/
function selectFAQ() {
	// display the proper FAQ by the selected support request type
	if ($F('srt').include('min_sys_req')) {
		loadFAQ('min_sys_req');		

	} else if ($F('srt').include('application_support')) {
		loadFAQ('application_support');		

	} else if ($F('srt').include('authorization_code')) {
		loadFAQ('authorization_code');		

	} else if ($F('srt').include('playback')) {
		if (isUsingComputerForDC == "true") {
			loadFAQ('pc_portable_playback_dcpc');		
		} else {
			loadFAQ('pc_portable_playback_notdcpc');		
		}
	} else {
		buildRequestForm();		

	}
}

/**
 * Builds the thank you page which is shown after sumitting the feedback form
 */
function buildThankYouForFeedback(arg)
{ 
	buildLoadingPopup();
	// build support form container
	var supportDiv = new Element('div', {id: 'supportform-content'});

	// build middle div 
	var middleDiv = new Element('div', {id: 'middle'}).addClassName('middle');
	
	var suppForm = new Element('form',{id:'csform'});
	
	var thankUDiv = new Element('div',{id:'cs-thankyou'});
	var thankULabel = new Element('div',{id:'thankyou-label'}).update('Thank you for using the support site');
	thankUDiv.insert(thankULabel);
	
	suppForm.insert(thankUDiv);
	middleDiv.insert(suppForm);
	supportDiv.insert(middleDiv);
		
	if(inApp=='true')
	{	//adjusting functionalty of in app, dispalaying full page now
		//$('bounding-area').update(supportDiv);
		//$('bounding-area').setStyle({width:'620px',height:'370px'});
		$('main-content').update(supportDiv);
	}
	else
		$('main-content').update(supportDiv);
	
	if(arg == '4')
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou4);
	else if(arg == '1')
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou1);
	else
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou2);
	
	if(inApp !='true')
	{
		//lang selector already built at this state
		//calling this function more then once results in duplicate text
		//buildLanguageSelector();
		
	}
	removeLoadingPopup();
}
/**
 * Builds auto response feed back form content
 */
function buildAutoResponseContent(arg)
{ 
	var response;
	 
	response = arg.responseText.evalJSON();
	//alert(response.authCode);
	//alert(response.status);
	//**alert(response.status);
	//**alert(response.authCode);
	//alert(Data.responsedata["Authorization Code Reset"].responseArray["en"].content );
	//alert(Data.salutationandclosing["en"].salutation );
	
	buildLoadingPopup();
	// build support form container
	var supportDiv = new Element('div', {id: 'supportform-content'});

	// build middle div 
	var middleDiv = new Element('div', {id: 'middle'}).addClassName('middle');
	
	var suppForm = new Element('form',{id:'csform'});
	
	var thankUDiv = new Element('div',{id:'response-thankyou'});
	var thankULabel = new Element('div',{id:'thankyou-label'});
	
	
	thankUDiv.insert(thankULabel);
	
	suppForm.insert(thankUDiv);
	middleDiv.insert(suppForm);
	supportDiv.insert(middleDiv);
	
	$('main-content').update(supportDiv);
	
	if(response.status == 'false')
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou2);
	else
		{$('thankyou-label').update(Data.responsedata[selectedForm].responseArray[selectedLang].content);
			
			if(response.authCode != "")
			$('thankyou-label').insert("<br/><br/>"+Data.formlabels[selectedLang].labelArray[0].authcode+" " +"  <font color=\"#FF540E\">"+ response.authCode+"</font>");
			if(discInfo == null)
			{discInfo = gatherSingleDiscInfo(selectedTitle);
			}
			
			if(getspecificdiscInfo('getsource', '') == 'DCON' )
			{
				if(getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle) != "")
				$('thankyou-label').insert("<br/><br/>URL: <a href=\"" +getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle)+"#override"+"\" target=\"_blank\">"+getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle) +"</a>");
			}
			
			
		}
	
	removeLoadingPopup();
	
}
/**
*	Builds the thank you page 
*/
function buildThankYou(arg) {
	log('Thank You: ' + arg);
	
	var omniVars = new Object();
	clearOmnitureParams(omniVars);
	var formatOmniture = '';
	omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Thank You";
	omniVars.channel = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Thank You";
	omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Thank You";
	omniVars.prop5 = userID; 
	omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle(selectedTitle)+": "+getDiscEdition(selectedTitle);
	omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource(selectedTitle);
	if(getDiscFormat(selectedTitle,'WMV') != '')
	{
		if(getDiscFormat(selectedTitle,'iTunes') != '')
		{
			formatOmniture = getDiscFormat(selectedTitle,'WMV')+" and "+getDiscFormat(selectedTitle,'iTunes');
		}
		else
		{
			formatOmniture = getDiscFormat(selectedTitle,'WMV');
		}
	}
	else
	{
		if(getDiscFormat(selectedTitle,'iTunes') != '')
		{
			formatOmniture = getDiscFormat(selectedTitle,'iTunes');
		}
	}
	omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+formatOmniture;
	doOmnitureTrackData(omniVars);	
	
	$('faq-content').hide();
	$('faq-resolve').hide();
	$('cs-request').hide();

	if (arg == 2) {
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou2);
	} else 	if (arg == 3) {
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou3);
	} else {
		$('thankyou-label').update(Data.thankyou[selectedLang].thankyou1);
	} 

	$('cs-thankyou').removeClassName('hidden');
	$('cs-thankyou').show();
	//buildLanguageSelector();
}

/**
*
*/
function buildRequestForm() {
	
	var omniVars = new Object();
	clearOmnitureParams(omniVars);
	var formatOmniture = '';
	omniVars.pageName = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Request Form";
	omniVars.channel = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Request Form";
	omniVars.prop1 = "DVD Support: "+selectedCountry+"-"+selectedLang+": DCAIRS Request Form";
	omniVars.prop5 = userID; 
	omniVars.prop3 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscTitle(selectedTitle)+": "+getDiscEdition(selectedTitle);
	omniVars.prop26 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+getDiscSource(selectedTitle);
	if(getDiscFormat(selectedTitle,'WMV') != '')
	{
		if(getDiscFormat(selectedTitle,'iTunes') != '')
		{
			formatOmniture = getDiscFormat(selectedTitle,'WMV')+" and "+getDiscFormat(selectedTitle,'iTunes');
		}
		else
		{
			formatOmniture = getDiscFormat(selectedTitle,'WMV');
		}
	}
	else
	{
		if(getDiscFormat(selectedTitle,'iTunes') != '')
		{
			formatOmniture = getDiscFormat(selectedTitle,'iTunes');
		}
	}
	omniVars.prop27 = "DVD Support: "+selectedCountry+"-"+selectedLang+": "+formatOmniture;
	doOmnitureTrackData(omniVars);	
	
	SupportForm.groups.each( function(item) {
		if (item.id == 'required') $('req-label').update(item.label);
	});
	
	$('cs-entry').hide();
	$('faq-content').hide();
	$('faq-resolve').hide();
	$('cs-thankyou').hide();

	// clear fields
	$('cs-error').update();
	$('firstname').clear();
	$('lastname').clear();
	$('email').clear();
	$('comments').clear();

	$('cs-request').removeClassName('hidden');
	$('csform').scrollTo(0,0);
}

/**
*	Builds the DVD title list in dropdown
*/
function buildTitleMap() {
	log('build title map list');
	// check if the list of title is present
	if (Titlemap.list == undefined) {
		log("TitleMap: list of titles is missing");
		Titlemap.loadXML();
//		return;
	}

	log("amount of items in title map: " + Titlemap.list.length);
	if(selectedSource != undefined && selectedSource != false && selectedSource != "")
	{
		if((selectedTitle != "" && selectedTitle != undefined && selectedTitle != null) && selectedSection!='LandingPage')
		{
			if(selectedSource == 'EC' && (selectedSection != 'Feedback' && selectedSection != 'SupportForm'))
				$('dvdtitle-ec').update(new Element('option', {value: selectedTitle}).update(getDiscTitle(selectedTitle)+" ("+getDiscEdition(selectedTitle)+")"));
			else{	
				if($('dvdtitle') != null)
					$('dvdtitle').update(new Element('option', {value: selectedTitle}).update(getDiscTitle(selectedTitle)+" ("+getDiscEdition(selectedTitle)+")"));
			}
		}
		else
		{
			if(selectedSource == 'EC' && (selectedSection != 'Feedback' && selectedSection != 'SupportForm'))
				$('dvdtitle-ec').update(new Element('option').update(Data.selectlabel[selectedLang].label));
			else{
				if($('dvdtitle') != null)
					$('dvdtitle').update(new Element('option').update(Data.selectlabel[selectedLang].label));
			}
		}
			
		Titlemap.list.each( function(item) {
			var discId = "";
			var source = "";
			var country = "";
			var edition = "";
			item.list.each(function(arg){ 
				if(arg.discId != undefined)
				{
					discId = arg.discId;
				}
				if(arg.source != undefined)
				{
					source = arg.source; 
				}
				if(arg.edition != undefined)
				{
					edition = arg.edition; 
				}
				if(source != "" && discId != "" && edition != "")
				{
					throw $break;
				}	
			});
			item.country.each(function(c){
				if(c.id != undefined)
				{
					country = c.id;
				}
			item.list.each(function(arg){
				if(arg.name != undefined)
				{
					if(source.include(selectedSource) && selectedSource == 'EC')
					{
						if(selectedSection == 'Feedback' || selectedSection == 'SupportForm' && country == selectedCountry )
						{
							if(selectedSection == 'LandingPage')
								$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							else if(discId != selectedTitle)
							 	$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
						}
						else if(country == selectedCountry)
						{
							if(selectedSection == 'LandingPage')
								$('dvdtitle-ec').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							else if(discId != selectedTitle)
								$('dvdtitle-ec').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
						}
					}
					else if((source.include("DC")) && country == selectedCountry && selectedSource != 'EC')
					{
						 //if(discId == '24A1947E-2789-46b2-9188-FB998A97CE0E'){alert(discId);}
						var currentURL = document.location.href.split(".");
						var currentDomain= currentURL[0].charAt(7);
						
						//current domain should yield either 'w'=live;'p'=preview/preview2;'d'=dev 
						switch(currentDomain)
						{
						case 'd':
						  
							if(selectedSection == 'LandingPage')
							{     
									$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							}
							else if(discId != selectedTitle)
							{   
										if(BrowserDetect.browser == "Explorer")
										{    
											 var dvdtitlebox = document.getElementById('dvdtitle');
											 var dvdtitleOpt = document.createElement('option');
										         dvdtitleOpt.text = arg.name+" ("+edition+")";
										         dvdtitleOpt.value = discId;
										         dvdtitlebox.add(dvdtitleOpt);
										         
										}
										else $('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							}						
							break;
						
						case 'p':
							
							if(selectedSection == 'LandingPage')
							{     
									$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							}
							else if(discId != selectedTitle)
							{   
								if(BrowserDetect.browser == "Explorer")
								{    
									 var dvdtitlebox2 = document.getElementById('dvdtitle');
									 var dvdtitleOpt2 = document.createElement('option');
								         dvdtitleOpt2.text = arg.name+" ("+edition+")";
								         dvdtitleOpt2.value = discId;
								         dvdtitlebox2.add(dvdtitleOpt2);
								         
								}
								else $('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));	
								
								
								
							}						
							break;
							case 'l':
							
							if(selectedSection == 'LandingPage')
							{     
									$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
							}
							else if(discId != selectedTitle)
							{   
								if(BrowserDetect.browser == "Explorer")
								{    
									 var dvdtitlebox2 = document.getElementById('dvdtitle');
									 var dvdtitleOpt2 = document.createElement('option');
								         dvdtitleOpt2.text = arg.name+" ("+edition+")";
								         dvdtitleOpt2.value = discId;
								         dvdtitlebox2.add(dvdtitleOpt2);
								         
								}
								else $('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));	
								
								
								
							}						
							break;
						
						default:
						//special Disc Id's not to show up in Live
						var specialDiscId1='24A1947E-2789-46b2-9188-FB998A97CE0E';
						var specialDiscId2='35921231-123F-4ee5-AEF3-99D330589458';
						var specialDiscId3='FILM2HOMEDEV';
						noshowTitles = new Array();
						for(var i=1 ; i < 29 ; i++)
						{noshowTitles.push('TESTTITLE'+i);
						}
											
						if(selectedSection == 'LandingPage')
						{
								if(($('dvdtitle') != null) && (discId != specialDiscId1) && (discId != specialDiscId2) && (discId != specialDiscId3)
								&& (checkTitle(discId))
								)
								{$('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));}
						}
						else if(discId != selectedTitle)
						{
							if(($('dvdtitle') != null) && (discId != specialDiscId1) && (discId != specialDiscId2) && (discId != specialDiscId3) && (checkTitle(discId))    )
							{
								if(BrowserDetect.browser == "Explorer")
								{    
									 var dvdtitlebox3 = document.getElementById('dvdtitle');
									 var dvdtitleOpt3 = document.createElement('option');
								         dvdtitleOpt3.text = arg.name+" ("+edition+")";
								         dvdtitleOpt3.value = discId;
								         dvdtitlebox3.add(dvdtitleOpt3);
								         
								}
								else $('dvdtitle').insert(new Element('option', {value: discId}).update(arg.name+" ("+edition+")"));
								
								
							}
						}
						
						
						
						}//end switch				
						
					}
				}
			});
			});
		});
		
			if($('dvdtitle') != null)
			{
			//	$('dvdtitle').setStyle({width:"auto"});
			
				// build the media type dropdown when a title is selected
				Event.observe($('dvdtitle'), 'change', function () {
					//log('buildTitleMap():  change the media type list ' + $F('dvdtitle'));
					this.removeClassName('highlight');
					if($('mediatype') != null)
						buildMediaTypeList();
				});
				//populate media type when the title is already selected(Support form page)
				if($F('dvdtitle') != Data.selectlabel[selectedLang].label)
				{
					if($('mediatype') != null)
						buildMediaTypeList();
				}	
			}	
	} else {
		log('WARNING: title map not built because selectedSource is ' + selectedSource);
	}
	log('build title map done');
	return;
}
function checkTitle(dID){
	var bool=true;
	for(var i=0 ; i < noshowTitles.length ; i++)
	{
		if(dID == noshowTitles[i] )
		{bool = false;break;}
			
	}


return bool;
}

/**
*	Builds the media type list
*/
function buildMediaTypeList() {
	log('build media type list.');
	var mediatype = "";
	
	// clear the media type list
	$('mediatype').update();
	
	var discId = "";
	var title =[];
	Titlemap.list.each(function(item){
		item.list.each(function(x)
		{
			if(x.discId != undefined)
			{
				
				if(x.discId ==$F('dvdtitle'))
				{
					discId = x.discId;
					title = item;
					throw $break;
				}
			}
		});
	});
//	log('build media type list: loop through each item.');
	var formatArr = [];
	title.country.each(function(c){
		if(c.id == selectedCountry)
		{
	c.formatArr.each(function(arg){
			if(arg.name != undefined)
			{
				//the selected format should be selected in the media type drop down
				if(selectedFormat != "")
				{
					if(selectedFormat == (arg.name).toLowerCase())
					{
						if(arg.name == "WMV")
							$('mediatype').update(new Element('option', {value: arg.name}).update("Windows Media"));
						else if(arg.name == "DCMANAGER")
							$('mediatype').update(new Element('option', {value: arg.name}).update("Digital Copy Manager"));
						else if(arg.name == "DCMOBILE")
							$('mediatype').update(new Element('option', {value: arg.name}).update("Digital Copy Mobile"));
						else			
							$('mediatype').update(new Element('option').update(arg.name));
					}
					else
					{
						if(arg.name == "WMV")
							formatArr.push("Windows Media");
						else if(arg.name == "DCMANAGER")
							formatArr.push("Digital Copy Manager");
						else if(arg.name == "DCMOBILE")
							formatArr.push("Digital Copy Mobile");
						else
							formatArr.push(arg.name);
					}
				}
				else
				{
					if(arg.name == "WMV")
						$('mediatype').update(new Element('option', {value: arg.name}).update("Windows Media"));
					else
						$('mediatype').insert(new Element('option').update(arg.name));
				}
			}
		});
		}
	});
	formatArr.each(function(item){
		$('mediatype').insert(new Element('option').update(item));
		
	});	
	$('mediatype').setStyle({width:"auto"});
	
	Event.observe($('mediatype'), 'change', function () {
		//log('remove media type highlight');
		this.removeClassName('highlight');
	});	
	return;
}

/**
*	Builds the transitional message for the FAQ
*/
function buildTransitionToFAQ(arg) {

	var faq = arg;
	// show the redirect popup
	var msgDiv = new Element('div').setStyle({padding: '10px'}).update(SupportForm.getTextLabel('detectmessage'));
	buildLoadingPopup(msgDiv);
	
	// change the page in 4 seconds
	new PeriodicalExecuter( function(pe) {
		loadFAQ(arg);
		removeLoadingPopup();
		pe.stop();
	}, 5);
}

/**
*	Build Question Areas Menu
*/
var SupportedFormatsArray =[];
//holder divs
var wmvQTab_DIV;
var itunesQTab_DIV
var dcmanagerQTab_DIV; 
var dcmobileQTab_DIV;
//holder
var wmvQTab_holder; 
var itunesQTab_holder;
var dcmanagerQTab_holder;
var dcmobileQTab_holder; 
//inactive
var wmvQTab_inactive; 
var itunesQTab_inactive;
var dcmanagerQTab_inactive;
var dcmobileQTab_inactive; 
//active
var wmvQTab_active;
var itunesQTab_active; 
var dcmanagerQTab_active;
var dcmobileQTab_active;
function buildQuestionArea(format,section) {
	
	var questionarea = new Element('div', {id:'questionarea'});
	questionarea.update('Question Areas');
	$('currentformat-tab').update(questionarea);	
			
	//var tmp45 = getspecificdiscInfo('format','dcm',selectedTitle);
	//alert(tmp45);
	
	
	//Figure out supported  for particular disc and only show those options
	//
	//
	//inactive
	wmvQTab_inactive = new Element('img',{src: 'images/common/logo_tmp_wmv_inactive.png',id:'wmvq',width:'122px', height:'93px'}).addClassName('tab button');
	itunesQTab_inactive =new Element('img',{src: 'images/common/logo_tmp_itunes_inactive.png',id:'itunesq',width:'122px', height:'93px'}).addClassName('tab button');
	dcmanagerQTab_inactive = new Element('img',{src: 'images/common/logo_tmp_dcmanager_inactive.png',id:'dcmanagerq',width:'122px', height:'93px'}).addClassName('tab button');
	dcmobileQTab_inactive =new Element('img',{src: 'images/common/logo_tmp_dcmobile_inactive.png',id:'dcmobileq',width:'122px', height:'93px'}).addClassName('tab button');
	//active
	wmvQTab_active = new Element('img',{src: 'images/common/logo_tmp_wmv.png',id:'wmvq',width:'122px', height:'93px'}).addClassName('tab button');
	itunesQTab_active =new Element('img',{src: 'images/common/logo_tmp_itunes.png',id:'itunesq',width:'122px', height:'93px'}).addClassName('tab button');
	dcmanagerQTab_active = new Element('img',{src: 'images/common/logo_tmp_dcmanager.png',id:'dcmanagerq',width:'122px', height:'93px'}).addClassName('tab button');
	dcmobileQTab_active =new Element('img',{src: 'images/common/logo_tmp_dcmobile.png',id:'dcmobileq',width:'122px', height:'93px'}).addClassName('tab button');
	
	
	
	
	/*
	 * Internet explore Hack
	 */
	
	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
	{
		//inactive
		wmvQTab_inactive = new Element('img',{src: 'images/common/logo_tmp_wmv.gif',id:'wmvq',width:'122px', height:'93px'}).addClassName('tab button');
		itunesQTab_inactive =new Element('img',{src: 'images/common/logo_tmp_itunes.gif',id:'itunesq',width:'122px', height:'93px'}).addClassName('tab button');
		dcmanagerQTab_inactive = new Element('img',{src: 'images/common/logo_tmp_dcmanager.gif',id:'dcmanagerq',width:'122px', height:'93px'}).addClassName('tab button');
		dcmobileQTab_inactive =new Element('img',{src: 'images/common/logo_tmp_dcmobile.gif',id:'dcmobileq',width:'122px', height:'93px'}).addClassName('tab button');
		//active
		wmvQTab_active = new Element('img',{src: 'images/common/logo_tmp_wmv.gif',id:'wmvq',width:'122px', height:'93px'}).addClassName('tab button');
		itunesQTab_active =new Element('img',{src: 'images/common/logo_tmp_itunes.gif',id:'itunesq',width:'122px', height:'93px'}).addClassName('tab button');
		dcmanagerQTab_active = new Element('img',{src: 'images/common/logo_tmp_dcmanager.gif',id:'dcmanagerq',width:'122px', height:'93px'}).addClassName('tab button');
		dcmobileQTab_active =new Element('img',{src: 'images/common/logo_tmp_dcmobile.gif',id:'dcmobileq',width:'122px', height:'93px'}).addClassName('tab button');
	    
		wmvQTab_inactive.addClassName('opacity');
		itunesQTab_inactive.addClassName('opacity');
		dcmanagerQTab_inactive.addClassName('opacity');
		dcmobileQTab_inactive.addClassName('opacity');
	}
		
	wmvQTab_DIV = new Element('div', {id: 'wmvQTab_DIV'}).insert( wmvQTab_inactive );
	itunesQTab_DIV = new Element('div', {id: 'itunesQTab_DIV'}).insert( itunesQTab_inactive );
	dcmanagerQTab_DIV = new Element('div', {id: 'dcmanagerQTab_DIV'}).insert( dcmanagerQTab_inactive );
	dcmobileQTab_DIV = new Element('div', {id: 'dcmobileQTab_DIV'}).insert( dcmobileQTab_inactive );
	
	/////////////////////////////////////////////////////////////////listeners for div elements
	
	if(section == 'gettingstarted')
	{			
				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
				{
					wmvQTab_inactive.observe('mouseover',function(){
						wmvQTab_inactive.removeClassName('opacity');
					});
					wmvQTab_inactive.observe('mouseout',function(){
						wmvQTab_inactive.addClassName('opacity');
					});
				}
				else{
						wmvQTab_inactive.observe('mouseover',function(){
							wmvQTab_inactive.src = "images/common/logo_tmp_wmv.png";
						});
						
						wmvQTab_inactive.observe('mouseout',function(){
							wmvQTab_inactive.src = "images/common/logo_tmp_wmv_inactive.png";
						});
				}
				wmvQTab_inactive.observe('click',function(){
					updateSupportSelectionTab('wmv',section);	
				});
				//------------------------
				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
				{
					itunesQTab_inactive.observe('mouseover',function(){
						itunesQTab_inactive.removeClassName('opacity');
					});
					itunesQTab_inactive.observe('mouseout',function(){
						itunesQTab_inactive.addClassName('opacity');
					});
						
				}else{
					itunesQTab_inactive.observe('mouseover',function(){
						itunesQTab_inactive.src = "images/common/logo_tmp_itunes.png";
					});
					
					itunesQTab_inactive.observe('mouseout',function(){
						itunesQTab_inactive.src = "images/common/logo_tmp_itunes_inactive.png";
					});
					
					
				}
				
				itunesQTab_inactive.observe('click',function(){
					updateSupportSelectionTab('itunes',section);		
				});
				//------------------------
				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
				{
					dcmanagerQTab_inactive.observe('mouseover',function(){
						dcmanagerQTab_inactive.removeClassName('opacity');
					});
					
					dcmanagerQTab_inactive.observe('mouseout',function(){
						dcmanagerQTab_inactive.addClassName('opacity');
					});
				}
				else{
					dcmanagerQTab_inactive.observe('mouseover',function(){
						dcmanagerQTab_inactive.src = "images/common/logo_tmp_dcmanager.png";
					});
					
					dcmanagerQTab_inactive.observe('mouseout',function(){
						dcmanagerQTab_inactive.src = "images/common/logo_tmp_dcmanager_inactive.png";
					});
				}
				dcmanagerQTab_inactive.observe('click',function(){
					updateSupportSelectionTab('dcmanager',section);
				});
				//------------------------
				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
				{
					dcmobileQTab_inactive.observe('mouseover',function(){
						dcmobileQTab_inactive.removeClassName('opacity');
					});
					
					dcmobileQTab_inactive.observe('mouseout',function(){
						dcmobileQTab_inactive.addClassName('opacity');
					});
				}
				else{
					dcmobileQTab_inactive.observe('mouseover',function(){
						dcmobileQTab_inactive.src = "images/common/logo_tmp_dcmobile.png";
					});
					
					dcmobileQTab_inactive.observe('mouseout',function(){
						dcmobileQTab_inactive.src = "images/common/logo_tmp_dcmobile_inactive.png";
					});
				}
				dcmobileQTab_inactive.observe('click',function(){
					updateSupportSelectionTab('dcmobile',section);
				});
	}
	else{
		
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		{
			wmvQTab_inactive.observe('mouseover',function(){
				wmvQTab_inactive.removeClassName('opacity');
			});
			
			wmvQTab_inactive.observe('mouseout',function(){
				wmvQTab_inactive.addClassName('opacity');
			});
		}
		else{
			wmvQTab_inactive.observe('mouseover',function(){
				wmvQTab_inactive.src = "images/common/logo_tmp_wmv.png";
			});
			
			wmvQTab_inactive.observe('mouseout',function(){
				wmvQTab_inactive.src = "images/common/logo_tmp_wmv_inactive.png";	
			});
		}
		wmvQTab_inactive.observe('click',function(){
			updateSupportSelectionTab('wmv','');
			
		});
		
		//------------------------
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		{
			itunesQTab_inactive.observe('mouseover',function(){
				itunesQTab_inactive.removeClassName('opacity');
			});
			
			itunesQTab_inactive.observe('mouseout',function(){
				itunesQTab_inactive.addClassName('opacity');
				});
		}
		else{
			itunesQTab_inactive.observe('mouseover',function(){
				itunesQTab_inactive.src = "images/common/logo_tmp_itunes.png";
			});
			
			itunesQTab_inactive.observe('mouseout',function(){
				itunesQTab_inactive.src = "images/common/logo_tmp_itunes_inactive.png";
				});
		}
		itunesQTab_inactive.observe('click',function(){
			updateSupportSelectionTab('itunes','');
		});
		//------------------------
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		{
			dcmanagerQTab_inactive.observe('mouseover',function(){
				dcmanagerQTab_inactive.removeClassName('opacity');
			});
			
			dcmanagerQTab_inactive.observe('mouseout',function(){
				dcmanagerQTab_inactive.addClassName('opacity');
			});
		}
		else{
			dcmanagerQTab_inactive.observe('mouseover',function(){
				dcmanagerQTab_inactive.src = "images/common/logo_tmp_dcmanager.png";
			});
			
			dcmanagerQTab_inactive.observe('mouseout',function(){
				dcmanagerQTab_inactive.src = "images/common/logo_tmp_dcmanager_inactive.png";
			});
		}
		dcmanagerQTab_inactive.observe('click',function(){
			updateSupportSelectionTab('dcmanager','');
		});
		//------------------------
		if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
		{
			dcmobileQTab_inactive.observe('mouseover',function(){
				dcmobileQTab_inactive.removeClassName('opacity');
			});
			
			dcmobileQTab_inactive.observe('mouseout',function(){
				dcmobileQTab_inactive.addClassName('opacity');
			});
		}
		else{
			dcmobileQTab_inactive.observe('mouseover',function(){
				dcmobileQTab_inactive.src = "images/common/logo_tmp_dcmobile.png";
			});
			
			dcmobileQTab_inactive.observe('mouseout',function(){
				dcmobileQTab_inactive.src = "images/common/logo_tmp_dcmobile_inactive.png";
			});
		}
		dcmobileQTab_inactive.observe('click',function(){
			updateSupportSelectionTab('dcmobile','');
		});
	
	
	}
	
	////////////////////////////////////////////////////////////end listeners for div elements
	
	
	
	SupportedFormatsArray =[];
	
	
	if(getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase() != "")
	{	
		if(getspecificdiscInfo('format','wmv',selectedTitle).toLowerCase() == 'wmv')
		{	SupportedFormatsArray.push({format:'wmv', qtab_inactive:wmvQTab_inactive,qtab_active:wmvQTab_active});
		}
		if(getspecificdiscInfo('format','itunes',selectedTitle).toLowerCase() == 'itunes')
		{	SupportedFormatsArray.push({format:'itunes',qtab_inactive:wmvQTab_inactive,qtab_active:wmvQTab_active});
		}
		if(getspecificdiscInfo('format','dcmanager',selectedTitle).toLowerCase() == 'dcmanager')
		{	SupportedFormatsArray.push({format:'dcmanager',qtab_inactive:dcmanagerQTab_inactive,qtab_active:dcmanagerQTab_active});
		}
		if(getspecificdiscInfo('format','dcmmobile',selectedTitle).toLowerCase() == 'dcmmobile')
		{	SupportedFormatsArray.push({format:'dcmobile',qtab_inactive:dcmobileQTab_inactive,qtab_active:dcmobileQTab_active});
		}
	}
	else{
		//no disc id provided so show everything
		SupportedFormatsArray.push({format:'wmv',qtab_inactive:dcmobileQTab_inactive,qtab_active:dcmobileQTab_active});
		SupportedFormatsArray.push({format:'itunes',qtab_inactive:dcmobileQTab_inactive,qtab_active:dcmobileQTab_active});
		SupportedFormatsArray.push({format:'dcmobile',qtab_inactive:dcmobileQTab_inactive,qtab_active:dcmobileQTab_active});
		SupportedFormatsArray.push({format:'dcmanager',qtab_inactive:dcmobileQTab_inactive,qtab_active:dcmobileQTab_active});
	}
	
	
	SupportedFormatsArray.each(function (item) {
		
		if(item.format == 'wmv')
			{
			
			$('currentformat-tab').insert(wmvQTab_DIV);
				
//				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
//			    {fixPNG(wmvQTab_inactive);}
//				wmvQTab_holder = $('wmvq'); 
				
			}
		if(item.format == 'itunes')
			{
			
			$('currentformat-tab').insert(itunesQTab_DIV);
			
//			if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
//			    {fixPNG(itunesQTab_inactive);alert('fixpng');}
//				itunesQTab_holder = $('itunesq');
				 
			}
		if(item.format == 'dcmanager')
			{
			
			$('currentformat-tab').insert(dcmanagerQTab_DIV);
//				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
//			    {fixPNG(dcmanagerQTab_inactive);}
//				dcmanagerQTab_holder = $('dcmanagerq');
				
			}
		if(item.format == 'dcmobile')
			{
			
			$('currentformat-tab').insert(dcmobileQTab_DIV);
//				if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
//			    {fixPNG(dcmobileQTab_inactive);}
//				dcmobileQTab_holder = $('dcmobileq');
			}
	});
	updateCurrentSectionHighlight(format,section);
	
}

function updateCurrentSectionHighlight(format,section){
	
	if(section == 'gettingstarted')
	{
		switch(format){
		case 'wmv':wmvQTab_DIV.update(wmvQTab_active);
				   onChangeWMV();
			break;
		case 'itunes':itunesQTab_DIV.update(itunesQTab_active);
					  onChangeITunes();
			break;
		case 'dcmanager':dcmanagerQTab_DIV.update(dcmanagerQTab_active);
					     onChangedcManager();
			break;
		case 'dcmobile':dcmobileQTab_DIV.update(dcmobileQTab_active);
						onChangedcMobile();
			break;
		
		default:
		}
	}
	else{
		switch(format){
		case 'wmv':wmvQTab_DIV.update(wmvQTab_active);
		onChangeWMVSupport();
			break;
		case 'itunes':itunesQTab_DIV.update(itunesQTab_active);
		onChangeITunesSupport();
			break;
		case 'dcmanager':dcmanagerQTab_DIV.update(dcmanagerQTab_active);
		onChangedcManagerSupport();
			break;
		case 'dcmobile': dcmobileQTab_DIV.update(dcmobileQTab_active);
		onChangedcMobileSupport();
			break;
		
		default:
		}
	}

}


function updateSupportSelectionTab(format,section){
	SupportedFormatsArray.each(function (item) {
				if(item.format == 'wmv')
					{
						if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7))
							wmvQTab_inactive.addClassName('opacity');
						else wmvQTab_inactive.src = "images/common/logo_tmp_wmv_inactive.png";
						wmvQTab_DIV.update(wmvQTab_inactive);
					}
				if(item.format == 'itunes')
					{
						 if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
							 itunesQTab_inactive.addClassName('opacity');
						 else itunesQTab_inactive.src = "images/common/logo_tmp_itunes_inactive.png";
						 itunesQTab_DIV.update(itunesQTab_inactive);
					}
				if(item.format == 'dcmanager')
					{	
						if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7))
							dcmanagerQTab_inactive.addClassName('opacity');
						else dcmanagerQTab_inactive.src = "images/common/logo_tmp_dcmanager_inactive.png";
						dcmanagerQTab_DIV.update(dcmanagerQTab_inactive);
					}
				if(item.format == 'dcmobile')
					{	if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) 
							dcmobileQTab_inactive.addClassName('opacity');
						else dcmobileQTab_inactive.src = "images/common/logo_tmp_dcmobile_inactive.png";
						dcmobileQTab_DIV.update(dcmobileQTab_inactive);
					}
	});
			
			if(section == 'gettingstarted')
			{
					switch(format){
					case 'wmv':
								wmvQTab_DIV.update(wmvQTab_active);
								onChangeWMV();
								if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) {fixPNG($('wmvq'));}
								break;
					case 'itunes':
								itunesQTab_DIV.update(itunesQTab_active);
								onChangeITunes();
								if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) {fixPNG($('itunesq'));}
								break;
					case 'dcmanager':
								dcmanagerQTab_DIV.update(dcmanagerQTab_active);
								onChangedcManager();
								if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) {fixPNG($('dcmanagerq'));}
								break;
					case 'dcmobile':
								dcmobileQTab_DIV.update(dcmobileQTab_active);
								onChangedcMobile();
								if ((BrowserDetect.version >= 5.5) && (BrowserDetect.version < 7)) {fixPNG($('dcmobileq'));}
								break;
								
					default:
					}	
			}
			else{
					
					switch(format){
					case 'wmv':
								wmvQTab_DIV.update(wmvQTab_active);
								onChangeWMVSupport();
								break;
					case 'itunes':
								itunesQTab_DIV.update(itunesQTab_active);
								onChangeITunesSupport();
								break;
					case 'dcmanager':
								dcmanagerQTab_DIV.update(dcmanagerQTab_active);
								onChangedcManagerSupport();
								break;
					case 'dcmobile':
								dcmobileQTab_DIV.update(dcmobileQTab_active);
								onChangedcMobileSupport();
								break;
								
					default:
					}
			}
			
}




/**
*	Retrieve  all the necessary info needed to display the Support or Getting Started section
*/
function getRequiredInfo() {
 
	selectedLang = getLanguage();
	selectedOS = getOS();
	selectedMediaType = getMediaType();
	selectedTitle = getTitle();
	selectedSource = getSource();
	selectedCountry = getCountry();
	selectedFormat = getFormat();
	
}

/** 
*	Displays the country flag on the header
*/
function buildStoredInfo() {
/*	$('stored-info').update();
	
	//if the section is not LandingPage then show the selected country's flag 
	if(selectedSection != 'LandingPage')
	{
		var label = Data.getChangeCountryLabel(selectedLang);
		var country = new Element('span').update(label).addClassName('button');
		var countryImg = new Element('img',{src:'images/common/flags/'+selectedCountry+'_flag.png' }).addClassName('countryflag').addClassName('button'); 
		var imgDiv = new Element('div');
		imgDiv.insert(country);
		imgDiv.insert(countryImg);
		
		Event.observe(country,'click',function(){
			buildLandingPage();
		});
		Event.observe(countryImg,'click',function(){
			buildLandingPage();
		});
		$('stored-info').insert(imgDiv);
	}
	else
	{
		
	}	*/
}


/************************** SET ***********************************/


/**
*	Store currently selected title in cookie
*/
function setTitle(arg) {
	selectedTitle = arg;	
	writePersistentCookie ('selectedTitle', arg, 'days', 30);
}

/**
*	Store currently selected title in cookie
*/
function setFormat(arg) {
	selectedFormat = arg;	
	
	writePersistentCookie ('selectedFormat', arg, 'days', 30);
}
/**
*	Store currently selected language in cookie
*/
function setLanguage(arg) {
	selectedLang = arg;	
	
	writePersistentCookie ('selectedLang', arg, 'days', 30);
}

/**
*	Store the current user id in cookie
*/
function setUserID(arg) {
	userID = arg;	
	
	writePersistentCookie ('userID', arg, 'days', 30);
}

/**
*	Store currently selected source(CD/EC) in cookie
*/
function setSource(arg) {
	selectedSource = arg;	
	
	writePersistentCookie ('selectedSource', arg, 'days', 30);
}

/**
*	Store currently selected country in cookie
*/
function setCountry(arg) {
	selectedCountry = arg;	
	
	writePersistentCookie ('selectedCountry', arg, 'days', 30);
}

/**
*	Store currently selected media type in cookie
*/
function setMediaType(arg) {
	selectedMediaType = arg;	
	
	writePersistentCookie ('selectedMediaType', arg, 'days', 30);
}

/**
*	Store currently selected OS in cookie
*/
function setOS(arg) {
	selectedOS = arg;	
	
	writePersistentCookie ('selectedOS', arg, 'days', 30);
}

/************************** GET ***********************************/

/**
*	Retrieve the stored language from cookie
*/

function getLanguage() {
	var langParam = getParamValue('lang');
	if (langParam == undefined || langParam == null) {
		var arg = getCookieValue('selectedLang');

		if (arg == undefined || arg == null || arg == false) {
			return "en";
		} else {
			return arg;
		}	
	} else {
		return langParam
	}
}

/**
*	Retrieve the user id from cookie
*/
function getUserID() {
	var arg = getCookieValue('userID');

	if (arg == undefined || arg == null || arg == false) {
		return new Date();
	} else {
		return arg;
	}	
}

/**
*	Retrieve the stored source from cookie
*/
function getSource() {
	var sourceParam = getParamValue('source');

	if (sourceParam == undefined || sourceParam == null) {
		var arg = getCookieValue('selectedSource');
		return arg;
	} else {
		return sourceParam;
	}
}

/**
*	Retrieve the stored format from cookie
*/
function getFormat() {
	var formatParam = getParamValue('format');

	if (formatParam == undefined || formatParam == null) {
		var arg = getCookieValue('selectedFormat');
		return arg;
	} else {
		return formatParam;
	}
}
/**
*	Retrieve the stored country from cookie
*/
function getCountry() {
	var countryParam = getParamValue('country');

	if (countryParam == undefined || countryParam == null) {
		var arg = getCookieValue('selectedCountry');
		if(arg == undefined || arg == null || arg == false)
			return "us";
		else
			return arg;
	} else {
		return countryParam;
	}
}

/**
*	Retrieve the stored movie title from cookie
*/
function getTitle() {
	var arg = getCookieValue('selectedTitle');
	
	if (arg == undefined || arg == null || arg == false) {
		
		return null;
	} else {
		
		return arg;
	}	
}

/**
*	Retrieve the stored media type from cookie
*/
function getMediaType() {
	var arg = getCookieValue('selectedMediaType');

	if (arg == undefined || arg == null || arg == false) {
		return null;
	} else {
		return arg;
	}	
}

/**
*	Retrieve the stored O/S from cookie, otherwise get version detected by javascript
*/
function getOS() {
	var arg = getCookieValue('selectedOS');

	if (arg == undefined || arg == null || arg == false) {
		return BrowserDetect.OS;
	} else {
		return arg;
	}	
}

/** 
*	Submit the Feedback form
*/
function submitFeedback() {
	log('thank you for the feedback');
}
/** 
*	Method formcountryConversion
*	params ( country String: <<two digit country code>>)
*	description: For form submital take the country code and return its full name
*	example pass in 'ca'  returns 'Canada' 
*/

function formcountryConversion(selectedCountry){
	var countrystr="";
	switch(selectedCountry){
	case 'au': countrystr = 'Australia';break;
	case 'be': countrystr = 'Belgique';break;
	case 'br': countrystr = 'Brasil';break;
	case 'ca': countrystr = 'Canada';break;
	case 'dk': countrystr = 'Danmark';break;
	case 'de': countrystr = 'Deutschland';break;
	case 'es': countrystr = 'Espana';break;
	case 'ch': countrystr = 'Die Schweiz';break;
	case 'ch': countrystr = 'Suisse';break;
	case 'ch': countrystr = 'Svizzera';break;
	case 'ie': countrystr = 'Ireland';break;
	case 'it': countrystr = 'Italia';break;
	case 'jp': countrystr = '&#26085;&#26412;';break;
	case 'mx': countrystr = 'Mexico';break;
	case 'nl': countrystr = 'Nederland';break;
	case 'nz': countrystr = 'New Zealand';break;
	case 'no': countrystr = 'Norge';break;
	case 'at': countrystr = 'Österreich';break;
	case 'se': countrystr = 'Sverige';break;
	case 'gb': countrystr = 'United Kingdom';break;
	case 'us': countrystr = 'United States';break;
	default:
	}
	
return countrystr;
}
/** 
*	Displays the page in the selected language
*/
function localizePage(lang) {
	log('Localize ' + selectedSection + ' to language (' + lang + ')');
	log('selectedLang is  ' + selectedLang);
	
	if (lang != selectedLang) {
		setLanguage(lang);
		
		log('language is now ' + selectedLang);
		
		if(selectedSection != "LandingPage")
		{
			buildHeader();
			buildFooter();
		}
			
		buildStoredInfo();
		buildCopyright();
		
		 if(selectedSection == "LandingPage"){
			 buildLandingPage();
		 }
		 else if(selectedSection == "Home"){
		 	loadHome();
		 }
		else if (selectedSection == "SupportForm") {
			loadSupportForm();
		} 
		else if (selectedSection == "EditTitle") {
			loadRequiredInfo();
		}
		else if(selectedSection == 'GettingStarted'){
			buildStoredInfo();
			loadGettingStarted()
		}
		else if(selectedSection == 'Expire'){
			gotoFORM(selectedForm);
		}
		else if(selectedSection == 'Feedback'){
			loadFeedbackForm()
		}
		else if(selectedSection == 'Privacy'){
			loadPrivacyPolicy()
		}
		else if(selectedSection == 'Terms')
		{
			loadTermsOfUse();
		}
		else if(selectedSection == 'Support')
		{
			buildLoadingPopup();
			buildSupport();
			
		}else {		
//			("<script>build" + selectedSection + "()</script>").evalScripts();
		}
	} else {
		log('language is the same ' + lang);
	}
}

/**
 * This method returns the dvd title based on the disc id.
 * @param {} discId
 * @return {}
 */
function getDiscTitle(discId)
{
	var title="";
	var flag = false; 
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			flag = true;
		}
		if(arg.name != undefined && flag == true && dId == discId.toLowerCase())
		{
			title = arg.name;
			throw $break;
		}
		})
	});
	return title;
}


/**
 * This method returns the disc format based on the disc id and format.
 * @param {} discId
 * @param {} format
 * @return {}
 */
function getDiscFormat(discId, format)
{
	
	var formatName="";
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			throw $break;
		}
	});
	if(dId == discId.toLowerCase())
	{
		item.country.each(function(c){
			if(c.id == selectedCountry)
			{
				c.formatArr.each(function(f){
					if(f.name != undefined )
					{
						var n = f.name;
						n = n.toLowerCase();
						
						if(n == 'itunes')
						{
							n = n.toLowerCase();
							if(format == undefined)
							{
								formatName = n;
								throw $break;
							}
							else if(n == format.toLowerCase())
							{
								formatName = n;
								throw $break;
							}
							 
						}
						else
						{
							n = f.name;
							if(n == format)
							{
								formatName = n;
								throw $break;
							}
							else if(format == undefined)
							{
								formatName = n;
								throw $break;
							}
						}
					}
				});
			}
			
		})
	}
	});
	return formatName;
	
}

/**
 * This method returns the provider based on disc id and provider name.
 * @param {} discId
 * @param {} pName
 * @return {}
 */
function getDiscProvider(discId, pName)
{
	var providerName="";
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			throw $break;
		}
	});
	if(dId == discId.toLowerCase())
	{
		item.country.each(function(c){
			if(c.id == selectedCountry)
			{
		c.formatArr.each(function(f){
			if(f.provider != undefined )
			{
				if(f.provider == pName)
				{
					providerName = f.provider;
					throw $break;
				}
				else if(pName == undefined)
				{
					providerName = f.provider;
					throw $break;
				}
					
				
			}
		});
			}
		});
	}
	});
	return providerName;
}

/**
 * This method returns the source based on disc id and source.
 * @param {} discId
 * @param {} sName
 * @return {}
 */
function getDiscSource(discId, sName)
{ 
	var sourceName="";
	var flag = false; 
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			flag = true;
		}
		if(arg.source != undefined && flag == true && dId == discId.toLowerCase())
		{
			if(arg.source == sName)
				sourceName = arg.source;
			else if(sName == undefined)
				sourceName = arg.source;
			throw $break;
		}
		})
	});
	return sourceName;
}

/**
 * This method returns the edition based on disc id .
 * @param {} discId
 * @param {} sName
 * @return {}
 */
function getDiscEdition(discId, sName)
{
	var edition="";
	var flag = false; 
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			flag = true;
		}
		if(arg.edition != undefined && flag == true && dId == discId.toLowerCase() )
		{
			if(arg.edition == sName)
				edition = arg.edition;
			else if(sName == undefined)
				edition = arg.edition;
			throw $break;
		}
		})
	});
	return edition;
}

/**
 * This method returns the country the disc belongs to based on the disc id and country.
 * @param {} discId
 * @param {} format
 * @return {}
 */
function getDiscCountry(discId, _thecountry)
{	var cName="";
	var theDiscInfo = [];
	theDiscInfo = gatherSingleDiscInfo(discId);
	if(theDiscInfo != undefined){
	theDiscInfo.each ( function(all) {
		//alert(all.discName +" "+all.discLang+" "+all.discSource);
				all.disccountryArr.each ( function(discdetail){ 
						
						//alert(discdetail.countryId + "-countryID-" + _thecountry);
						if(_thecountry == discdetail.countryId )
						{
							cName = _thecountry;
							//alert(cName + "cname");
							throw $break;
						}	
							//discdetail.discformatArr.each(function(discdetailformat){
							
							//alert(discdetailformat.formatName);
				
						//});
				});
		
		
		});
}
return cName;
	/*
	var cName="";
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId = id;
			
			throw $break;
		}
	});
	if(dId == discId.toLowerCase())
	{
		item.country.each(function(c){
			if(c.id != undefined )
			{
				var cty = country;
				if(country != undefined && country != "")
				{
					cty = country.toLowerCase();
				}
				if(c.id.toLowerCase() == cty)
				{
					cName = c.id;
					throw $break;
				}
				else if(country == undefined)
				{
					cName = c.id;
					throw $break;
				}
			}
		});
	}
	});
	return cName;
	*/
}
/**
 * This method returns all disc information.
 * @param {} Option
 *  * @return {} :String
 */
function getspecificdiscInfo(content,option,_selectedTitle)
{ 
	//example call :    getspecificdiscInfo('formatmatchprovider','DCMANAGER',selectedTitle);	
	//getspecificdiscInfo('getsource', '')
	//getspecificdiscInfo('gettitle', '')
	//getspecificdiscInfo('getcountry', 'us')
	if(option != undefined)
	{	
	var _discinfo ="";
	var thediscformat="";
	var thediscprovider="";
	var thediscsource=""
	var getdiscsource="";
	var getdisctitle="";
	var getdiscedition ="";
	var expiredate ="";
	var redeemURL = "";
	var getdisccountry = "";
	var formatMatchprovider=false;
	//var discInfo =[];
	//discInfo = gatherSingleDiscInfo(_selectedTitle);	
	
	if(discInfo != undefined)
	{	
	discInfo.each ( function(all) {
	//alert(all.discName +" "+all.discLang+" "+all.discSource);
			if(all.discSource != undefined){
				getdiscsource = all.discSource;
				if(all.discSource.toLowerCase() == option.toLowerCase())
				{
				 thediscsource=all.discSource;	
				}
				if(all.expire != '' && all.expire != undefined && option.toLowerCase() == 'date')
				{
				 expiredate=all.expire;	
				}
				if(all.discName != '' && all.discName != undefined)
				{
					getdisctitle =all.discName;	
				}
				if(all.redemptionURL != '' && all.redemptionURL != undefined && option.toLowerCase() == 'redemptionurl')
				{
					redeemURL=all.redemptionURL;	
				}
				if(all.discEdition != '' && all.discEdition != undefined && content == 'getedition')
				{
					getdiscedition= all.discEdition;	
				}
			all.disccountryArr.each ( function(discdetail){ 
				
					if(content == 'getcountry' && discdetail.countryId != undefined && option == discdetail.countryId)//alert(discdetail.countryId);
						{	//alert(discdetail.countryId + " disc detail country id Option="+ option);
							getdisccountry = discdetail.countryId;
							throw $break;
						}
						discdetail.discformatArr.each(function(discdetailformat){
							if(content == 'formatmatchprovider')
							{	var params = option.split(',');
								//alert(params[0] +" = "+ discdetailformat.formatName);//Format
								//alert(params[1] + " = "+ discdetailformat.formatProvider);//Provider
								//alert(discdetailformat.formatName +"<>"+ discdetailformat.formatProvider);
								if( params[0].toLowerCase() == discdetailformat.formatName.toLowerCase() && params[1].toLowerCase() == discdetailformat.formatProvider.toLowerCase() )
								{formatMatchprovider = true;throw $break;}
							}
							if(discdetailformat.formatName.toLowerCase() == option.toLowerCase() )
							{	
								thediscformat = discdetailformat.formatName;
								throw $break;
								//alert(discdetailformat.formatName);
							}
							if(discdetailformat.formatProvider.toLowerCase() == option.toLowerCase())
							{
								thediscprovider = discdetailformat.formatProvider;
								throw $break;
							
							}
						});
				});
	}//end if
	
	});
	}//end if discInfo != undefined
			switch(content){
			
						case "provider": 
							 return thediscprovider;
							 break;
						case "format":				
							 return thediscformat;
							 break;
						case "source":	
							 return thediscsource;
							 break;	
						case "expire":	
							 return expiredate;
							 break;	
						case "formatmatchprovider":	
							 return formatMatchprovider;
							 break;
						case "redemptionURL":	
							 return redeemURL;
							 break;
						case "getedition":	
							 return getdiscedition;
							 break;
						case "getsource":	
							 return getdiscsource;
							 break;
						case "gettitle":	
							 return getdisctitle;
							 break;
						case "getcountry":	
							 return getdisccountry;
							 break;	
						default:log("no method found");
						return "";
			}
	}
	//return _discinfo;
}

/**
 * This method returns all disc information.
 * @param {} discId
 *  * @return {} :array
 */
function gatherSingleDiscInfo(title)
{
	if(title == "")
		return;
	var singlediscInfo =[];
	var _disccountryArr= [];
	var _discformatArr=[];
	var _discId,_discName,_discLang,_discSource,_discEdition;
	var _countryId,_prodUrl;
	var _formatName,_formatProvider;
	var _expire;
	var _redemptionURL;
	var flag = false; 
   
	
	if(!useDTM)
	{
   
	Titlemap.list.each(function(item){
	
    	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(title != "" && id == title.toLowerCase())
		{   //found the title in title map that matches param title
			dId =  id;
			flag = true;
		}
		if(flag == true && dId == title.toLowerCase())
		{//at this point found the disc, now retrieve specific information
			
			if(arg.discId != undefined)
			{   _discId = arg.discId;
				//alert(arg.discId);
			}
			if(arg.name != undefined)
			{   _discName= arg.name;
				//alert(arg.name);
			}
			if(arg.language != undefined)
			{	_discLang=arg.language;
				//alert(arg.language);
			}
			if(arg.source != undefined)
			{	_discSource = arg.source;
				//alert(arg.source);
			}
			if(arg.expire != undefined)
			{	_expire = arg.expire;
				//alert(arg.expire);
			}
			if(arg.redemptionURL != undefined)
			{	_redemptionURL = arg.redemptionURL;
				//alert(arg.expire);
			}
			if(arg.edition != undefined)
			{	_discEdition = arg.edition;
				//alert(arg.edition);
			}
			item.country.each(function(x){
				//alert("selected country" +selectedCountry + " x=" +x.id);
				//if(x.id != undefined && x.id == selectedCountry)
				if(x.id != undefined )
				{	//alert(x.id + "x.id");
					_countryId=x.id;
						x.formatArr.each(function(f){
							if(f.name != undefined)
							{ _formatName = f.name
								//alert(f.name);	
							}
							if(f.provider != undefined)
							{
								_formatProvider= f.provider;
							}
						_discformatArr.push({formatName:_formatName,formatProvider:_formatProvider});
						});
				}
				//code to prevent duplicate countries from being inserted into _disccountryArr
				//thus causing FAQ and other sections to load longer then expected
				var duplicateCountry=false;
				for(var i=0 ; i<_disccountryArr.length ; i++ )
	 			{
					if(_disccountryArr[i].countryId != undefined && _disccountryArr[i].countryId == _countryId){
						duplicateCountry = true;
						throw $break;
					}
					else{
						duplicateCountry = false;
					}
	 			}
				if(duplicateCountry == false)
				{_disccountryArr.push({countryId:_countryId, discformatArr:_discformatArr});
				}
			});	
		}
		});
	});  
    singlediscInfo.push({discId:_discId,discName:_discName,discLang:_discLang,discSource:_discSource,disccountryArr:_disccountryArr,expire:_expire,redemptionURL:_redemptionURL,discEdition:_discEdition});
	
	}
	else{
	
		/*New updates for dynamic gathering of disc info */
	 	new Ajax.Request('mydata/discinfo.php', {
	        method: 'get',
	        asynchronous: false,
	 		parameters: { discid:title , country:selectedCountry},
	        //onComplete: this.processResponse2.bind(this),
	        onComplete: function(obj){
	 			var response;
	 			response = obj.responseText.evalJSON();
	 			
	 			_discId = response.Disc.DiscID;	
	 			_discName=response.Disc.Name;
	 			_discLang = response.Disc.Language;
	 			_discSource = response.Disc.Source;
	 			
	 			_countryId = response.Disc.Country.Id;
	 			
	 			//var fArray = response.Disc.Country.Format;
	 			//alert(fArray.length);
	 			for(var i=0 ; i<response.Disc.Country.Format.length ; i++ )
	 			{
	 				_formatName = response.Disc.Country.Format[i].Name; 
	 				_formatProvider =response.Disc.Country.Format[i].Provider; 
	 				_discformatArr.push({formatName:_formatName,formatProvider:_formatProvider});
	 			}
	 			 			
	 			
	 			
	 			_disccountryArr.push({countryId:_countryId, discformatArr:_discformatArr});
	 			
	 			
	 			_expire= response.Disc.ExpireDate;
	 			_redemptionURL = response.Disc.RedemptionURL;
	 			
	 			singlediscInfo.push({discId:_discId,discName:_discName,discLang:_discLang,discSource:_discSource,disccountryArr:_disccountryArr,expire:_expire,redemptionURL:_redemptionURL});
	        }	        
	      });
		
		
	}
    
    
    
    
    return singlediscInfo;
}

/**
 * This method returns the collection value based on the disc id and collection value.
 * @param {} discId
 * @param {} format
 * @return {}
 */
function getDiscCollection(discId, collection)
{   
	var collectName="";
	var flag = false; 
	Titlemap.list.each(function(item){
	var dId = '';
	item.list.each(function(arg){
		var id = arg.discId;
		if(arg.discId != undefined)
		{
			id = id.toLowerCase();
		}
		if(discId != "" && id == discId.toLowerCase())
		{
			dId =  id;
			flag = true;
		}
		if(item.collection != undefined && flag == true && dId == discId.toLowerCase())
		{   			
			/*item.collection.each(function(c){
				try{
					//for some reason c never == HUB, alternate code is below
					if(c == 'HUB')
						{alert("HUB val exists"+c);
					    ct+=1;
					    }
				}
				catch(error){}
				
				if(c == collection)
					collectName = c;
				else if(collection == undefined)
					collectName = c;
				throw $break;
			})*/
			for(var i=0; i<item.collection.length;i++)
			{
				if(item.collection[i] == collection)
					collectName = item.collection[i];
				else if(collection == undefined)
					collectName = collectName = item.collection[i];
				
			}
				
				
		}
		})
	});
	return collectName;
}

function clearOmnitureParams(omniVars)
{
	omniVars.pageName = '';
	omniVars.channel =  '';
	omniVars.prop1 = '';
	omniVars.prop5 = ''; 
	omniVars.prop3 = '';
	omniVars.prop26 = '';
	omniVars.prop27 = '';
	omniVars.prop28 = '';
	omniVars.prop29 = '';
	omniVars.prop30 = '';
	omniVars.prop31 = '';
	omniVars.prop32 = '';
	omniVars.prop33 = '';
	omniVars.prop34 = '';
	
}

 function getPIDHUBCountry(title, country,SPPT)
 {     
	 
	 	var option=false;
	    var pidcountry="";
		var flag = false; 
	    pidcountry = country;
	Titlemap.list.each(function(item){
		var dId = '';
		item.list.each(function(arg){
			var id = arg.discId;
			if(arg.discId != undefined)
			{
				id = id.toLowerCase();
			}
			if(title != "" && id == title.toLowerCase())
			{   //found the title in title map that matches param title
				dId =  id;
				flag = true;
			}
			if(flag == true && dId == title.toLowerCase())
			{//at this point found the disc, now retrieve country information
				item.country.each(function(x){
					
					x.pidhubsppt.each(function(f){
					if(f.pidhubinfo != null && f.pidhubinfo != undefined && x.id == country)    
					{	
						if(f.pidhubinfo.length>1)//PID && HUB
					    { if(f.pidhubinfo[0]==SPPT)
					    	option=true;
					      if(f.pidhubinfo[1]==SPPT)
					    	  option=true;
					    }
						else if(f.pidhubinfo[0]==SPPT)
						{
							option=true;
						}
						else{option=false;}
						//alert(x.id +" pid/hub " + f.pidhubinfo[0]+ " array length"+f.pidhubinfo.length);
					}
					
					
					});
				});	
			}
			//alert(item.country.id);
			/*if(item.collection != undefined && flag == true && dId == title.toLowerCase())
			{   			
			   for(var i=0; i<item.collection.length;i++)
				{
					if(item.collection[i] == country)
						collectName = item.collection[i];
					else if(collection == undefined)
						collectName = collectName = item.collection[i];				
				}		
			}*/
			})
		});  
		
		return option;	 
	 
 }
function gotoFAQ(id)
{
	if($(id))
	{	
	selectedTopSupportQue=id;
	buildSupport();
	}
	else{
	log("FAQ id ("+id+") does not exist");	
	}
}

 
 
function showhideLangList(option,currLang,currSect)
{   
	
	var chglabel="";
	LangSelector.languageNav.langHeader.each(function(m){
			
		if(m.langid == currLang)
	     {
	    	chglabel=m.langlabel; 
	        throw $break;
	     }
	
	
	});
	
	var langmenuBtn = new Element('label').update(chglabel);
	var landPageBtn = new Element('label').addClassName('button maindc').update(HeaderNav[4].strip());
	Event.observe(landPageBtn, 'click', function(event) {
		window.location.href='/home/';
	});	
	Event.observe(landPageBtn, 'mouseover', function(event) {
		landPageBtn.addClassName('onhover');
	});
	Event.observe(landPageBtn, 'mouseout', function(event) {
		landPageBtn.removeClassName('onhover');
	});    
  

   if(currSect =='Privacy' || currSect == 'Terms' )
   {
	    
		
			langmenuBtn.update();
			$('langmenu-content').update();
			$('langmenu-content').update(landPageBtn);
   
   }
    //show language list
   if(option && currSect != 'Privacy' && currSect != 'Terms')
	{
			//$('menu-content').insert("<br>");
			$('menu-content').insert(langmenuBtn).insert("<br>");
			$('menu-content').insert(langmenuBtn);
		
		var langList = new Element('div');
		var menuBtn = new Element('img',{src:'images/common/menu_btn.png',width:'27px',height:'27px'});
		try{   
			LangSelector.languageNav.list.each(function(item) {
			var langBtn = new Element('label').addClassName('button').update(item.label);
			Event.observe(langBtn, 'click', function(event) {
				localizePage(item.id);
			});	
			Event.observe(langBtn, 'mouseover', function(event) {
				langBtn.addClassName('onhover');
			});
			Event.observe(langBtn, 'mouseout', function(event) {
				langBtn.removeClassName('onhover');
			});			
			langList.insert(langBtn).insert("<br>");
		});	
		   $('langmenu-content').update(langList);
		   $('langmenu-content').insert(landPageBtn);
	}
	catch(error){
		log("Error populating Language List Side Menu"+error);
	    }	
	}
	return;
}

/****
 * Go to URL
 */
function visit(url) {
	window.location.href = url;
}

/**
 * This method opens third party app so select phone
 * @return {}
 * 
 * 
 */
var mobiclipwindow;
function openPhoneSelect(){
	
	//window.open('http://m.dcm.warnerbros.com?view=adddevice&source=supportsite','phone_popup','width=700,height=700,scrollbars=1');
	//window.open('http://wb.mobiclip.com/?view=adddevice&source=supportsite','phone_popup','width=610,height=550,scrollbars=1');
	//mobiclipwindow = window.open('phoneapp_test.htm','phone_popup','width=610,height=550,scrollbars=1');
	mobiclipwindow = window.open('/mobiclip?view=adddevice&source=supportsite','phone_popup','width=1000,height=600,scrollbars=1');
	return false;
	
}
var phoneArray = [];

/**
 * This method supports third party app so select phone
 * @return {}
 * 
 * 
 */

function setPhoneInfo(cons, phonemodel){
	mobiclipwindow.window.close();
	  
	if(inMobiClipList(cons))
	{
		
	//in list
	$('pmd').update('');
	selector = document.getElementById('pmd');  
	selector.options[0] = new Option(phonemodel, phonemodel);

	selector = document.getElementById('pmdm');

	for(i=0 ; i <= selector.options.length -1 ; i++)
			{
				if(selector.options[i].text == 'Refer to device model')
				{
				 selector.selectedIndex = i; break;
				}
				else if(selector.options[i].text == cons)
				{
					 selector.selectedIndex = i; break;
				}
			}	



	}
	else{
	//not in list
	phoneArray.push({cns:cons, pmodel:phonemodel});
	var selector = document.getElementById('pmdm');  
	selector.options[selector.options.length] = new Option(cons);
	selector.selectedIndex = selector.options.length -1;

	$('pmd').update('');
	selector = document.getElementById('pmd');  
	selector.options[0] = new Option(phonemodel, phonemodel);
	}

	   
	   
}

/**
 * This method supports third party app so select phone
 * @return {}
 * 
 * 
 */

function inMobiClipList(selected){


	var found = false;
	var search_Term = document.getElementById('pmdm');
			
				
			for(i=0 ; i <= search_Term.options.length -1 ; i++)
			{
				if(search_Term.options[i].text == selected)
				{
				 found= true; break;
				}
			}	
		return  found;
	}

function findPhoneManufacturer(phone){
	var str="";
	for(var i=0; i< phoneArray.length; i++)
	{		
		if(phone == phoneArray[i].cns)
		{
			
		foundphone= true;	
		str= phone;
		}
	}
	return str;
}
/***
 * Method datecountryFormat()
 * Params(date:String , country:String)
 * Returns the date in the country format 
 */

function datecountryFormat(expirationDate, country){
	dstr = '';
	if(expirationDate == '')
		return dstr;
	
	formatdate = expirationDate.split('/');
	//Month
	m = formatdate[0];
	//Day
	d = formatdate[1];
	//Year
	y = formatdate[2];
	
	
	
	
	if(country == 'us'){dstr= m +'/'+d+'/'+y;}//United States
	else if(country == 'ca'){dstr= m +'/'+d+'/'+y;}//Canada
	else if(country == 'mx'){dstr= d +'/'+m+'/'+y;}//Mexico 
	else if(country == 'br'){dstr= d +'/'+m+'/'+y;}//Brazil 
	else if(country == 'gb'){dstr= d +'/'+m+'/'+y;}//United Kingdom
	else if(country == 'ie'){dstr= d +'/'+m+'/'+y;}//Ireland
	else if(country == 'de'){dstr= d +'/'+m+'/'+y;}//Germany 
	else if(country == 'at'){dstr= d +'/'+m+'/'+y;}//Austria 
	else if(country == 'be'){dstr= d +'/'+m+'/'+y;}//Netherlands-Belgium
	else if(country == 'nl'){dstr= d +'/'+m+'/'+y;}//Netherlands-Holland 
	else if(country == 'it'){dstr= d +'/'+m+'/'+y;}//Italy
	else if(country == 'es'){dstr= d +'/'+m+'/'+y;}//Spain
	else if(country == 'be'){dstr= d +'/'+m+'/'+y;}//Belgique 
	else if(country == 'dk'){dstr= d +'/'+m+'/'+y;}//Denmark 
	else if(country == 'no'){dstr= d +'/'+m+'/'+y;}//Norway
	else if(country == 'se'){dstr= d +'/'+m+'/'+y;}//Sweden 
	else if(country == 'fi'){dstr= d +'/'+m+'/'+y;}//Finland 
	else if(country == 'ch'){dstr= d +'/'+m+'/'+y;}//Switzerland
	else if(country == 'au'){dstr= d +'/'+m+'/'+y;}//Austrailia
	else if(country == 'nz'){dstr= d +'/'+m+'/'+y;}//New Zealand
	else if(country == 'jp'){dstr= y +'/'+m+'/'+d;}//Japan
	else{dstr= m +'/'+d+'/'+y;}
	return dstr;
}
 /**
  * compared two dates
  *  
  */
 
 function compDate(date1,dateformat1,date2,dateformat2) {
		var d1=getDateFromFormat(date1,dateformat1);
		var d2=getDateFromFormat(date2,dateformat2);
		
		if (d1==0 || d2==0) {
			return -1;
			}
		else if (d1 > d2) {
			return 1;
			}
		return 0;
		}
	function _isInteger(val) {
		var digits="1234567890";
		for (var i=0; i < val.length; i++) {
			if (digits.indexOf(val.charAt(i))==-1) { return false; }
			}
		return true;
		}
	function _getInt(str,i,minlength,maxlength) {
		for (var x=maxlength; x>=minlength; x--) {
			var token=str.substring(i,i+x);
			if (token.length < minlength) { return null; }
			if (_isInteger(token)) { return token; }
			}
		return null;
		}

	function getDateFromFormat(val,format) {
		val=val+"";
		format=format+"";
		var i_val=0;
		var i_format=0;
		var c="";
		var token="";
		var token2="";
		var x,y;
		var now=new Date();
		var year=now.getYear();
		var month=now.getMonth()+1;
		var date=1;
		var hh=now.getHours();
		var mm=now.getMinutes();
		var ss=now.getSeconds();
		var ampm="";
		
		while (i_format < format.length) {
			// Get next token from format string
			c=format.charAt(i_format);
			token="";
			while ((format.charAt(i_format)==c) && (i_format < format.length)) {
				token += format.charAt(i_format++);
				}
			// Extract contents of value based on format token
			if (token=="yyyy") {
				if (token=="yyyy") { x=4;y=4; }
				year=_getInt(val,i_val,x,y);
				if (year==null) { return 0; }
				i_val += year.length;
			}
			else if (token=="MM"||token=="M") {
				month=_getInt(val,i_val,token.length,2);
				if(month==null||(month<1)||(month>12)){return 0;}
				i_val+=month.length;}
			else if (token=="dd"||token=="d") {
				date=_getInt(val,i_val,token.length,2);
				if(date==null||(date<1)||(date>31)){return 0;}
				i_val+=date.length;
				}
			else {
				if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
				else {i_val+=token.length;}
				}
			}
		// If there are any trailing characters left in the value, it doesn't match
		if (i_val != val.length) { return 0; }
		// Is date valid for month?
		if (month==2) {
			// Check for leap year
			
			if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
				if (date > 29){ return 0; }
				}
			else { if (date > 28) { return 0; } }
			}
		if ((month==4)||(month==6)||(month==9)||(month==11)) {
			if (date > 30) { return 0; }
			}
		var newdate=new Date(year,month-1,date,hh,mm,ss);
		return newdate.getTime();
		}

	
function gotoFORM(id){
	
		selectedForm = id;
		selectedSection = "Expire";
		positionMainContent(selectedSection);
		buildHash("expire-area");
		log('display the expire form');

		Data.formlabels[selectedLang].labelArray[0].lname
		
		
		//alert(Data.formlabels[selectedLang].labelArray.fname);
		
		// create Expire-content container
		var expireformDiv = new Element('div', {id: 'expire-content', name:'expire-content'});
		
		// create middle div
		var middleDiv = new Element('div', {id: 'middle'} );
		expireformDiv.insert(middleDiv);

		// display text (ie 'Please submit the feedback form')
		var faqDiv = new Element('div').addClassName('faq');
		middleDiv.insert(faqDiv);

		// display instructions	
		var instructDiv = new Element('div',{id:'instructdiv'}).addClassName('feedbackquestion').update();
		faqDiv.insert(instructDiv);
		
		
		//build first name
		var fNameDiv = new Element('div').addClassName('group');
		var fNameLabel = new Element('span',{id:'firstname-label'}).addClassName('dd-label').update(Data.formlabels[selectedLang].labelArray[0].fname);
		var req = new Element('span').addClassName('required').update('*');
		var fName = new Element('input',{type:'text',id:'firstname'});
		fNameLabel.insert(req);
		fNameDiv.insert(fNameLabel);
		fNameDiv.insert(fName);
		
		//build last name
		var lNameDiv = new Element('div').addClassName('group');
		var lNameLabel = new Element('span',{id:'lastname-label'}).addClassName('dd-label').update(Data.formlabels[selectedLang].labelArray[0].lname);
		var lreq = new Element('span').addClassName('required').update('*');
		var lName = new Element('input',{type:'text',id:'lastname'});
		lNameLabel.insert(lreq);
		lNameDiv.insert(lNameLabel);
		lNameDiv.insert(lName);
		
		//build email address
		var emailDiv = new Element('div').addClassName('group');
		var emailLabel = new Element('span',{id:'email-label'}).addClassName('dd-label').update(Data.formlabels[selectedLang].labelArray[0].email);
		var req = new Element('span').addClassName('required').update('*');
		var email = new Element('input',{type:'text',id:'email'});
		emailLabel.insert(req);
		emailDiv.insert(emailLabel);
		emailDiv.insert(email);
		
		
		//Build AuthCode Field
		var authcodeDiv = new Element('div').addClassName('group');
		var authcodeLabel = new Element('span',{id:'email-label'}).addClassName('dd-label').update(Data.formlabels[selectedLang].labelArray[0].authcode);
		var req = new Element('span').addClassName('required').update('*');
		var authcode = new Element('input',{type:'text',id:'authcode'});
		//authcodeLabel.insert(req);
		authcodeDiv.insert(authcodeLabel);
		authcodeDiv.insert(authcode);
		
		
		//Build Comments Field
		var commentsDiv = new Element('div').addClassName('group');
		var commentsLabel = new Element('span',{id:'email-label'}).addClassName('dd-label').update(Data.formlabels[selectedLang].labelArray[0].comments);
		//var req = new Element('span').addClassName('required').update('*');
		var comments = new Element('textarea',{id:'comments',rows:'3',cols:'35',wrap:'soft'}).setStyle({overflow:'auto'});
		
		//authcodeLabel.insert(req);
		commentsDiv.insert(commentsLabel);
		commentsDiv.insert('<br/>').insert(comments);
		
		//Build Captcha Div
		var captchaDiv = new Element('div', {id:'captchaDIV'});
		
		
		faqDiv.insert(fNameDiv);
		faqDiv.insert('<p></p>');
		faqDiv.insert(lNameDiv);
		faqDiv.insert('<p></p>');
		faqDiv.insert(emailDiv);
		faqDiv.insert('<p></p>');
		faqDiv.insert(authcodeDiv);
		faqDiv.insert('<p></p>');
		faqDiv.insert(commentsDiv);
		faqDiv.insert('<p></p>');
		faqDiv.insert(captchaDiv);
		
		
			
		//build Submit button
		var submitDiv = new Element('div');
		submitDiv.setStyle({marginLeft:'130px', padding:'20px'});
		var submitLabel = new Element('input',{type:'button', id:'submitfaqform',value:"Submit"});
		submitDiv.insert(submitLabel);
		faqDiv.insert(submitDiv);
		
		$('main-content').update(expireformDiv);
		
		
		
		//Insert Captcha Module After it is found on the DOM
		Recaptcha.create("6LcutLoSAAAAANen64H1Aq5t2sOjhZUaTljwYUHl", 'captchaDIV', {
	        theme: 'blackglass',
			lang:selectedLang,
	        tabindex: 0
	    });
		
		
		$('instructdiv').update(Data.formlabels[selectedLang].labelArray[0].formheader);
		/*$('dvdtitle-label').update(FeedbackForm.getTextLabel('title')).insert(new Element('span'));
		$('feature-label').update(FeedbackForm.getTextLabel('feature')).insert(new Element('span').update('*').addClassName('required'));
		$('rate-label').update(FeedbackForm.getTextLabel('rate')).insert(new Element('span').update('*').addClassName('required'));
		$('comments-label').update(FeedbackForm.getTextLabel('comments'));
		*/
			
		//$('submitfeedback').value= FeedbackForm.getTextLabel('submit');
		
		$('submitfaqform').value= "Submit";
		$('submitfaqform').observe('click',function(){
			
			
			
			if($('submitfaqform').hasClassName('disabled')) {
				log('Button is disabled. Disallowing request.');
				return;
			}
			
			$('submitfaqform').addClassName('disabled');
			
			
			
			var captchavalid = validateCaptcha();
			var emailFormat = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			var ip = '<!--#echo var="REMOTE_ADDR"-->';
			
			if ($F('firstname')== null || $F('firstname')== '' ) {	
				$('firstname').focus();
				$('firstname').addClassName('highlight');
				$('submitfaqform').removeClassName('disabled');
		   }else if ($F('lastname')== null || $F('lastname')== '' ) {	
				$('lastname').focus();
				$('lastname').addClassName('highlight');
				$('submitfaqform').removeClassName('disabled');
		   }else if(!emailFormat.test($F('email')) || $F('email') ==null) {	
				$('email').focus();
				$('email').addClassName('highlight');
				$('submitfaqform').removeClassName('disabled');
		   }/*else if ($F('authcode')== null || $F('authcode')== '' ) {	
				$('authcode').focus();
				$('authcode').addClassName('highlight');
				$('submitfaqform').removeClassName('disabled');
		   }*/else if(Recaptcha.get_response() == '')
		   {    Recaptcha.focus_response_field();
		   		$('submitfaqform').removeClassName('disabled');
		   }else if(!captchavalid){
			   alert('invalid captcha');
			   $('submitfaqform').removeClassName('disabled');
			   Recaptcha.reload();
			   
		   }
		   else{
			   
			   
			  /* var emailData = {
					   firstname: $F('firstname'),
					   lastname: $F('lastname'),
					   sender: $F('email'),
					   language:selectedLang,
					   description: $F('comments'),
					   emailaddress: $F('email'),
					   authcode:  $F('authcode'),
					   disctitle:getDiscTitle(selectedTitle),
					   discid:selectedTitle,
					   subject: 'Special FAQ Support Request',
					   type: 'customerSupport',
      				   edition:getDiscEdition(selectedTitle),
      				   isLoyaltyRequest:false,
      				   dcRequestType:selectedForm,
      				   ipaddress:ip,
      				   country:selectedCountryConversion
					}
			   */
			   discInfo = gatherSingleDiscInfo(selectedTitle);
			   var selectedCountryConversion = formcountryConversion(selectedCountry); 
				
				
				
				
				var dropdownObj = [];
				dropdownObj.push({"id":"60" , "value":"797"});
				dropdownObj.push({"id":"24" , "value":"1"});
				dropdownObj.push({"id":"77" , "value":"123"});
				
				
				if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) != "")
						dropdownObj.push({"id":"35","value":paratureTranslate(35,getspecificdiscInfo('gettitle', ''))});
				if(paratureTranslate(34,selectedForm) != "")
					 dropdownObj.push({"id":"34","value":paratureTranslate(34,selectedForm)});
				if(paratureTranslate(32,selectedCountryConversion) != "")
					dropdownObj.push({"id":"32","value":paratureTranslate(32,selectedCountryConversion)});
				if(paratureTranslate(67,getspecificdiscInfo('getedition', '')) != "")
					dropdownObj.push({"id":"67","value":paratureTranslate(67,getspecificdiscInfo('getedition', ''))});
				if(paratureTranslate(62,selectedLang) != "")
					dropdownObj.push({"id":"62" , "value":paratureTranslate(62,selectedLang)});
				if(paratureTranslate(61,getspecificdiscInfo('getsource', ''))!= "")
					dropdownObj.push({"id":"61" , "value":paratureTranslate(61,getspecificdiscInfo('getsource', ''))});
							
				var entryFieldsObj = [];
				var commentsParatureField="";
				if($F('comments').include("&"))
				{	commentsParatureField = $F('comments');
					commentsParatureField = commentsParatureField.replace(/&/g, "&amp;"); }
				else{commentsParatureField = $F('comments');}
				
				
				var autoresponseaparaturefield = Data.salutationandclosing[selectedLang].salutation +",<br/><br/>" + Data.responsedata[selectedForm].responseArray[selectedLang].content + "<br/><br/>" + Data.salutationandclosing[selectedLang].closing;
				
				autoresponseaparaturefield = autoresponseaparaturefield.replace(/</g, "&lt;");
				autoresponseaparaturefield = autoresponseaparaturefield.replace(/>/g, "&gt;");
				
				//entryFieldsObj.push( {"id":"88","value":autoresponseaparaturefield});
				
				
				entryFieldsObj.push( {"id":"28","value":commentsParatureField});
				entryFieldsObj.push( {"id":"66","value":selectedTitle});
				entryFieldsObj.push( {"id":"74","value":getspecificdiscInfo('expire','date',selectedTitle)});
				entryFieldsObj.push( {"id":"37","value":$F('authcode')});
				
				
				if(getspecificdiscInfo('getsource', '') == "DCOD")
				{  //build this URL for deeplink example below
				   //http://dev.wbdigitalcopy.com/support/?lang=en#GetStarted&discid=C19115C9-B882-4664-B3CB-C6C5D54D56BF&country=us
					try{
					
					var str = document.location + "";
					var _instructionSplit = str.split("#");
					
					if(_instructionSplit[0].include("?"))
					{	var str2 = _instructionSplit[0].split("?");
						var deeplinkinstrunctionsURL = str2[0] +"?lang="+selectedLang+"#GetStarted&amp;discid="+selectedTitle +"&amp;country="+selectedCountry;
					}
					else{
					var deeplinkinstrunctionsURL = _instructionSplit[0] +"?lang="+selectedLang+"#GetStarted&amp;discid="+selectedTitle +"&amp;country="+selectedCountry;
					}
					
					
					var DLIURL = "&lt;a href=\""+deeplinkinstrunctionsURL+"\"&gt;"+ Data.salutationandclosing[selectedLang].clickhere +"&lt;/a&gt;";	
					}catch(e){}
					entryFieldsObj.push(  {"id":"72","value":DLIURL});
				}
				else if(getspecificdiscInfo('getsource', '') ==  "DCON")
				{
					entryFieldsObj.push(  {"id":"72","value":getspecificdiscInfo('redemptionURL','redemptionURL',selectedTitle)});
				}
				
				if(paratureTranslate(35,getspecificdiscInfo('gettitle', '')) == "")
				  entryFieldsObj.push( {"id":"65", "value":getspecificdiscInfo('gettitle', '')});
				entryFieldsObj.push( {"id":"27", "value":"Special FAQ Support Request - "+getspecificdiscInfo('gettitle', '') });
				
			   var emailData = $H({
					"customDropDownFields":dropdownObj,
					"customEntryFields":entryFieldsObj  ,
					"requestType":selectedForm,
					"departmentId":"15027",
					"email":$F('email'),
					"firstName":$F('firstname'),
					"lastName":$F('lastname'),
					"memeberOf":{"id":"33","value":"30"}
				}).toJSON();
				
			   
			   
			   var autoitunesProcess = false;
			   if(  getspecificdiscInfo('format','iTunes',selectedTitle) == 'iTunes')
				   autoitunesProcess= true;
			   
				
				var autoresponseemailData = $H({
					"customDropDownFields":dropdownObj,
					"customEntryFields":entryFieldsObj  ,
					"requestType":selectedForm,
					"format":autoitunesProcess,
					"departmentId":"15027",
					"email":$F('email'),
					"firstName":$F('firstname'),
					"lastName":$F('lastname'),
					"memeberOf":{"id":"33","value":"30"}
				}).toJSON();
			  
			   RequestForm.loadXML(emailData);
			  
			 /*  if(selectedForm == 'Expired Offer: New Redemption')
			   {   RequestForm.loadXML(emailData);}  
			   else{
				   AutoResponse.loadXML(autoresponseemailData);
			    }
			  */
		   }
		});
}

function validateCaptcha()
{
var bool = false;
	if(Recaptcha.get_response() != '')
	{
		var url = '../captcha?';
		var response = 'response=' + Recaptcha.get_response() ;
		var challenge = '&challenge=' + Recaptcha.get_challenge();
		var privatekey = '&privatekey=6LcutLoSAAAAAH0UNMmayyKXW0QyS6ceKBHxUFn_'
		//var remoteip = '&remoteip=' + ipaddress;
		var fullURL = url + response + challenge+ privatekey;
		
		
		new Ajax.Request (fullURL, {
			method: 'post',
			asynchronous: false,
			onSuccess: function (transport) 
						{ var captchaReturnstr = transport.responseText;
						  //alert(captchaReturnstr);
						  var captchaStr = captchaReturnstr.split('\n');
						  if(captchaStr[0] == 'true')
						  bool = true;
						  else
							bool= false;
						},
			onComplete: function (transport) { log(ref.xml + " loaded completely");},
			onFailure: function (transport) { log(ref.xml + " failed to load");}
		});	
	}
return bool;
	
}
/**
 * ParatureTranslate(id, string)
 * params (id: Id of the category from parature string: item we are looking for)
 */
 function paratureTranslate(id,string){
	 
	 if(string.include('DVD Edici'))
	 {	string = "DVD Special Edition";
	 }
	 if(string == "min_sys_req")
	 {	
		 string = "Minimum System Requirements";
	 }
	 if(string == "application_support")
	 {	
		 string = "Digital Copy Application Support";
	 }
	 if(string == "authorization_code")
	 {	
		 string = "Authorization Code and Licenses";
	 }
	 if(string == "pc_portable_playback")
	 {	
		 string = "PC and Portable Digital Copy Playback";
	 }
	 if(string == "other")
	 {	
		 string = "Other";
	 }
	 
	 
	 if(paratureSchemaInfo == null)
	 {	ParatureSchema.loadXML();
		paratureSchemaInfo = ParatureSchema.Parature_Field;
	 }
	 var val="";
	 if(id == "")
		 return val;
	 paratureSchemaInfo[id].values.each(function(item){
		 
		 if(id == 32 )
		 {   
			 if(string.substring(0,3)== 'Esp' && item.value.substring(0,3) == string.substring(0,3) )
			 {
				 val = item.id;
				 throw $break;
			 }
		 }
		 if(item.value == string)
		 {val = item.id;
		  throw $break;
		 }
	 });
	 	 
return	val;
 }
 
 