
var moviesSelector = '<select onchange="window.location=(this.options[this.selectedIndex].value)">'
		+ '<option value="">Select a Movie</option>'
+ '    <optgroup title="-- Coming Soon --" label="-- Coming Soon --">'
+ '        <option value="http://beastly-movie.co.uk">Beastly</option>'
+ '        <option value="http://www.cemeteryjunction.co.uk/">Cemetery Junction</option>'
+ '        <option value="http://www.eatpraylove.co.uk">Eat Pray Love</option>'
+ '        <option value="/movies/thegreenhornet/">The Green Hornet</option>'
+ '        <option value="http://www.grownups-movie.co.uk/">Grown Ups</option>'
+ '        <option value="/movies/priest/">Priest</option>'
+ '        <option value="http://www.salt-movie.co.uk/">Salt</option>'
+ '        <option value="http://www.thebackupplan.co.uk">The Back Up Plan</option>'
+ '        <option value="http://karatekid-movie.co.uk/">The Karate Kid</option>'
+ '    </optgroup>'
+ '    <optgroup title="-- At Cinemas --" label="-- At Cinemas --">'
+ '        <option value="/movies/armored/">Armored</option>'
+ '        <option value="http://www.celinedion-movie.co.uk/">Celine: Through The Eyes Of The World</option>'
+ '        <option value="http://DidYouHearAboutTheMorgans.co.uk">Did You Hear About The Morgans?</option>'
+ '        <option value="http://www.extraordinarymeasures-movie.co.uk">Extraordinary Measures</option>'
+ '        <option value="http://www.legion-movie.co.uk/">Legion</option>'
+ '        <option value="http://thebountyhunter-movie.co.uk/">The Bounty Hunter</option>'
+ '    </optgroup>'
+ '  </select>';

var tvSelector = '<select onchange="window.location=(this.options[this.selectedIndex].value)">'
+ '<option value="">Select a TV Show</option>'
+ '    <optgroup title="-- Animation --" label="-- Animation --">'
+ '        <option value="/tv/shows/astroboy/">Astro Boy</option>'
+ '    </optgroup>'
+ '    <optgroup title="-- Comedies --" label="-- Comedies --">'
+ '        <option value="/tv/shows/bewitchedgenerationzap/">Bewitched</option>'
+ '        <option value="/tv/shows/marriedwithchildren/">Married...with Children</option>'
+ '        <option value="/tv/shows/seinfeld/">Seinfeld</option>'
+ '        <option value="/tv/shows/soap/">Soap</option>'
+ '    </optgroup>'
+ '    <optgroup title="-- Drama --" label="-- Drama --">'
+ '        <option value="/tv/shows/dawsonscreek/">Dawson\'s Creek</option>'
+ '        <option value="/tv/shows/joanofarcadia/">Joan of Arcadia</option>'
+ '        <option value="/tv/shows/rescueme/">Rescue Me</option>'
+ '    </optgroup>'
+ '    <optgroup title="-- Reality/Game shows --" label="-- Reality/Game shows --">'
+ '        <option value="/tv/shows/dragonsden/">Dragon\'s Den</option>'
+ '    </optgroup>'
+ '    <optgroup title="-- Talk Shows --" label="-- Talk Shows --">'
+ '        <option value="/tv/shows/rickilake/">Ricki Lake</option>'
+ '    </optgroup>'
+ '  </select>';

function checkAllSelectors() {
    checkSelector('movieselector', moviesSelector);
    checkSelector('tvselector', tvSelector);
}

function checkSelector(targetNodeId, targetContents) {
    var node = document.getElementById(targetNodeId);
    if (node) {
        node.innerHTML = targetContents;
    }
}

addLoadEvent(checkAllSelectors);
addLoadEvent(getAdFeedbackLink);

function getAdFeedbackLink()
{
    var element = document.getElementById("ad_feedback");
    if(element != null)
    {
    	element.onclick = function() {
    		adFeedBackId(element);
    		return false;
    	}
    }
}

function adFeedBackId(element) {
	var feedbackbanneridElement = document.getElementById("feedbackbannerid");
    if (feedbackbanneridElement != null) {
		var feedbackId = feedbackbanneridElement.innerHtml;
	    var href = element.getAttribute("href");
	    href = href + "?ad=" + feedbackId;
	    element.setAttribute("href",href);	    
    }
    href = element.getAttribute("href");
	window.open(href,'_blank');
    return false;
}