$(function(){

	$('[name="headlineText"]').keyup(function(){ setHeadline($(this).val()); });
	$('[name="typeOfMedia"]').keyup(function(){ setTypeOfMedia($(this).val()); });
});

function setHeadline(value){

    var headlineMaker = getFlashMovieObject("headlineMaker");
    if(headlineMaker != null) headlineMaker.SetVariable("headlineText", value.toUpperCase()); 
}

function setTypeOfMedia(value){

    var headlineMaker = getFlashMovieObject("headlineMaker");
    if(headlineMaker != null) headlineMaker.SetVariable("typeOfMedia", value); 
}

function getFlashMovieObject(id){

	if(window.document[id]) return window.document[id];

	if(navigator.appName.indexOf("Microsoft Internet") == -1) {

    	if (document.embeds && document.embeds[id]) return document.embeds[id];
    	return document.getElementById(id);
  	}
  
	return document.getElementById(id);
}
