// JavaScript Document
var qmjs = {};
qmjs.MarketMovers = function(){
	document.getElementById('MarketMovers').innerHTML = this.parseHTML(arguments[0]);
}
qmjs.Currencies = function(){
	document.getElementById('Currencies').innerHTML = this.parseHTML(arguments[0]);
}
qmjs.parseHTML = function(HTML){
	var r = [new RegExp(/style=\".*?\"/gi), new RegExp(/&nbsp;/gi), new RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'img'), new RegExp('javascript:openDetail_[0-9]{0,4}[\(]', 'img')]
	var w = ["", "", "", 'javascript: qmjs.openDetail('];
	for(var i = 0; i < r.length; i++){
		HTML = HTML.replace(r[i], w[i]);
	}
	HTML = HTML.replace('qmmt_text', 'first qmmt_text');
	HTML = HTML.replace('tr class="qmmt_main"', 'tr class="first qmmt_main"');
	return(HTML);
}
qmjs.openDetail = function(symbol){
	var w = 520;
	var h = 260;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1';
	win = window.open("http://app.quotemedia.com/quotetools/clientForward?targetURL=" + escape('http://app.quotemedia.com/quotetools/popups/quote.jsp?webmasterId=94743') + "&cp=on&symbol=" + symbol, "DetailedQuote", winprops);
	if (parseInt(navigator.appVersion) >= 4) {
		win.focus();
	}
}

qmjs.showNews = function(storyId, topic) {
	var w = 730;
	var h = 450;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1';
	win = window.open("http://app.quotemedia.com/quotetools/clientForward?targetURL=" + escape('http://app.quotemedia.com/quotetools/popups/story.jsp')  + "&storyId="  + storyId  + "&topic="  + topic, "DetailedQuote", winprops);
	if (parseInt(navigator.appVersion) >= 4) {
		win.focus();
	}
}

var qm_futures = {};
qm_futures.openDetail = function(s){
	var w = 530;
	var h = 360;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1';
	
	win = window.open("http://www.quotemedia.com/clients/futures/?symbol=" + s, "FuturesQuote", winprops);

	if (parseInt(navigator.appVersion) >= 4) {
		win.focus();
	}
}

/*  shaffick's popup */
function popNews(Url) {
	var w = 530;
	var h = 360;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1';
	
	win = window.open(Url, "NewsPopup", winprops);
	
	if (parseInt(navigator.appVersion) >= 4) {
		win.focus();
	}
}

function popVideo(url) {
	window.open(url,'mywin', 'left=20,top=20,width=480,height=350,toolbar=0,location=0,directories=0,resizable=0');
}

