
function MM_goToURL() { //v3.0
	var i, args = MM_goToURL.arguments;
	document.MM_returnValue = false;
	for (i = 0; i < (args.length - 1); i += 2) {
		eval(args[i] + ".location='" + args[i + 1] + "'");
	}
}
function setChecked(form, chkName, val) {
	dml = document.forms[form];
	len = dml.elements.length;
	for (i = 0; i < len; i++) {
		if (dml.elements[i].id != null && dml.elements[i].id != "" && dml.elements[i].id == chkName) {
			dml.elements[i].checked = val;
		}
	}
}
function openListManagerWindow(winName, factoryName, ids, foreignForm, foreignAttributeCallBack) {
	var url = "list-manager.do?fct=" + factoryName + "&ids=" + ids;
	win = window.open(url, winName, "width=370, height=340");
	win.foreignForm = foreignForm;
	win.foreignAttributeCallBack = foreignAttributeCallBack;
	win.focus();
}
function openListFormManagerWindow(winName, factoryName, elements, foreignForm, foreignAttributeCallBack) {
	var url = "list-form-manager.do?lff=" + factoryName + "&elements=" + elements;
	win = window.open(url, winName, "width=370, height=340");
	win.foreignForm = foreignForm;
	win.foreignAttributeCallBack = foreignAttributeCallBack;
	win.focus();
}
function openTermsOfUseWindow() {
	win = window.open("template-popup.do?url=/dynamic/terms-of-use-body.jsp", "popup_terms", "toolbar=no,menubar=no,scrollbars=no,resizable=no,width=520,height=577");
	win.focus();
}
function openPrintDetailPreviewWindow(winName, url) {
	win = window.open(url, winName, "toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
	win.focus();
}
function openShowImageWindow(winName, url) {
	win = window.open(url, winName, "toolbar=no,menubar=no,scrollbars=no,resizable=no,width=520,height=577");
	win.focus();
}
function openMediaPlayerWindow(winName, url) {
	win = window.open(url, winName);
	win.focus();
}
function MM_swapImgRestore() { //v3.0
	var i, x, a = document.MM_sr;
	for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) {
		x.src = x.oSrc;
	}
}
function MM_preloadImages() { //v3.0
	var d = document;
	if (d.images) {
		if (!d.MM_p) {
			d.MM_p = new Array();
		}
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for (i = 0; i < a.length; i++) {
			if (a[i].indexOf("#") != 0) {
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
		}
	}
}
function MM_findObj(n, d) { //v4.01
	var p, i, x;
	if (!d) {
		d = document;
	}
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) {
		x = d.all[n];
	}
	for (i = 0; !x && i < d.forms.length; i++) {
		x = d.forms[i][n];
	}
	for (i = 0; !x && d.layers && i < d.layers.length; i++) {
		x = MM_findObj(n, d.layers[i].document);
	}
	if (!x && d.getElementById) {
		x = d.getElementById(n);
	}
	return x;
}
function MM_swapImage() { //v3.0
	var i, j = 0, x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for (i = 0; i < (a.length - 2); i += 3) {
		if ((x = MM_findObj(a[i])) != null) {
			document.MM_sr[j++] = x;
			if (!x.oSrc) {
				x.oSrc = x.src;
			}
			x.src = a[i + 2];
		}
	}
}
function changeVideoTrailerState(videoTrailerId, videoTrailerState) {
	changeFormProperty("searchResultForm", "videoTrailerId", videoTrailerId);
	changeFormProperty("searchResultForm", "videoTrailerState", videoTrailerState);
	doPostBack("searchResultForm", "changeVideoTrailerStateAction");
}
function preloadImages() {
	MM_preloadImages("static/images/bt_sell_on.gif", "static/images/bt_account_on.gif", "static/images/bt_ipextv_on.gif", "static/images/bt_signin_on.gif", "static/images/bt_joinnow_on.gif", "static/images/bt_help_on.gif", "static/images/bt_go_on.gif", "static/images/bt_searchtips_on.gif", "static/images/bt_advanced_on.gif", "static/images/bt_administration_on.gif", "static/images/arrow_next_on.gif", "static/images/arrow_nextend_on.gif", "static/images/arrow_previous_on.gif", "static/images/arrow_previousstart_on.gif");
}
function openShowVideoTrailerClipWindow(winName, vt) {
	var url = "show-video-trailer-clip.do?vt=" + vt;
	win = window.open(url, winName, "width=640, height=360, resizable=yes");
	win.focus();
}
function exportPlaylist(winName, vtstate) {
	var url = "export-playlist.do?vtstate=" + vtstate;
	win = window.open(url, winName);
	win.focus();
}
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == "string") {
			element = document.getElementById(element);
		}
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements.length != 0 ? elements : null;
}
function filterByPortfolio(selectedPortfolioId) {
	changeFormProperty("searchResultForm", "portfolioId", selectedPortfolioId);
	doPostBack("searchResultForm", "filterByPortfolioAction");
}
function processCarriageReturn(textareaId){
	replaceWith='<br>';
	textarea = document.getElementById(textareaId);
	textarea.value=escape(textarea.value);
	for(i=0; i<textarea.value.length; i++){
		if(textarea.value.indexOf("%0D%0A") > -1){
			textarea.value=textarea.value.replace("%0D%0A",replaceWith);
		}
		else if(textarea.value.indexOf("%0A") > -1){
			textarea.value=textarea.value.replace("%0A",replaceWith);
		}
		else if(textarea.value.indexOf("%0D") > -1){
			textarea.value=textarea.value.replace("%0D",replaceWith);
		}
	}
	textarea.value=unescape(textarea.value);
}
function escapeTextArea(textareaId){
	textarea = document.getElementById(textareaId);
	textarea.value=escape(textarea.value);
}
function unescapeTextArea(textareaId){
	textarea = document.getElementById(textareaId);
	textarea.value=unescape(textarea.value);
}