/* ---------------------------------------------------------------		FUNCTION.JS -- FOURDIGIT JavaScript BASAE FUNCTIONS	Copyright (c) FOURDIGIT Inc. All Rights Reserved.		--------------------------------------------------------------- *//*	EXTEND LIBRARY*/jQuery.extend();jQuery.fn.extend();var rootPath = function(){	return jQuery('script#coreJS')[0].src.split('script/js')[0];}/*	AUTOMATION*///FUNCTION initRollOversfunction initRollOvers(){	if(!document.getElementById) return;	var preImgArr = new Array();	$('img.ahover').each(function(){		var src = $(this).attr('src');		var isov = src.substring(0,src.lastIndexOf('.'));		if( isov.substring(isov.length-3, isov.length) != "_ov"		 && isov.substring(isov.length-3, isov.length) != "_on"		 && isov.substring(isov.length-4, isov.length) != "_off"		){			var ftype = src.substring(src.lastIndexOf('.'), src.length);			var hsrc = src.replace(ftype, '_ov'+ftype);			var dsrc = src;			$(this).attr('hsrc', hsrc);			$(this).attr('dsrc', dsrc);			preImgArr.push(new Image());			preImgArr[preImgArr.length-1].src = hsrc;			$(this).bind('mouseover', function(e){				$(this).attr('src', $(this).attr('hsrc'));				enablePNG (this);			});			$(this).bind('mouseout', function(e){				$(this).attr('src', $(this).attr('dsrc'));				enablePNG (this);			});			if ($.browser.safari) {				$(this).bind('click', function(e){					$(this).attr('src', $(this).attr('dsrc'));					enablePNG (this);				});			}		}	});}//FUNCTION enableFlash (for IE6.5+ on winXP SP2 KB912945)function enableFlash(){	if(jQuery.browser.msie) {		jQuery('object, applet, embed').each(function () {			this.removeAttribute('data');			this.outerHTML += "";		});	}}//FUNCTION enablePNGfunction enablePNG (obj) {	if(jQuery.browser.msie){		if(obj && /\.png/.test(obj.src)) {			var imgSource = obj.src;			obj.src = rootPath()+'share_imgs/space.gif';			obj.style.filter = 				'progid:' +				'DXImageTransform.Microsoft.AlphaImageLoader' +				'(src="' + imgSource + '",' +				'sizingMethod="scale")';		}else{			jQuery('img[@src*=png]').each(function () {				var imgSource = this.src;				this.src = rootPath()+'share_imgs/space.gif';				this.style.filter = 					'progid:' +					'DXImageTransform.Microsoft.AlphaImageLoader' +					'(src="' + imgSource + '",' +					'sizingMethod="scale")';			});		}	}}//FUNCTION enableCSSPNGfunction enableCSSPNG (){	if(jQuery.browser.msie){		var styleSheets = document.styleSheets['masterCSS'].imports;		//for (var i = 0; i < styleSheets.length; i++) {		for (var i in styleSheets) {			var styleSheet = styleSheets[i];			var rules = styleSheet.rules || styleSheet.cssRules;			//for (var j = 0; j < rules.length; j++) {			for (var j in rules) {				var rule = rules[j];				var styles = rule.style;				for (var property in styles) {					var val = styles[property];					if( !/png/.test(val) || !/backgroundImage/.test(property) ) continue;					var regEx = new RegExp("[\.\.\/\]+(([^\"\'\'\"\)]*)\)","");					var reg = val.match(regEx);					var imgSrc = RegExp.$1;					var filter = '' +							'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' +							rootPath() + imgSrc +							'", sizingMethod="scale");';					styleSheet.addRule(rule.selectorText, "background-image:none");					styleSheet.addRule(rule.selectorText, filter);				}			}		}	}}//FUNCTION cssBrowserSelectorvar cssBrowserSelector = function() {	var	ua = navigator.userAgent.toLowerCase(),	is = function(t){ return ua.indexOf(t) != -1; },	h = jQuery('body')[0],	b =	(!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ('ie ie'+RegExp.$1)			: is('gecko/') ? 'gecko'			: is('opera/9') ? 'opera opera9'			: /opera (\d)/.test(ua) ? 'opera opera'+RegExp.$1			: is('konqueror') ? 'konqueror'			: is('applewebkit/') ? 'webkit safari'			: is('mozilla/') ? 'gecko'			: '',	o= (is('x11')||is('linux')) ?' linux'			:is('mac') ? ' mac'			:is('win') ? ' win'			:'';	var c = b+o+' js';	h.className += h.className? ' '+c : c;};//FUNCTION smoothScrollvar actX;var actY;var tarY = 0;var tarX = 0;var scrollInt;var smoothScroll = function () {	jQuery('a').each(function(){		var anc = this.href.split('#')[1];		if( /#/.test(this.href)  && this.href.match(location.href) && jQuery('#'+anc)[0] ){			this.href="javascript:void(0);";			jQuery(this).bind('click', function  (){				tarX = (jQuery(document).width() > jQuery('#'+anc).position().left + jQuery(window).width())					? jQuery('#'+anc).position().left					: jQuery(document).width() - jQuery(window).width();				tarY = (jQuery(document).height() > jQuery('#'+anc).position().top + jQuery(window).height())					? jQuery('#'+anc).position().top					: jQuery(document).height() - jQuery(window).height();			  actX = jQuery(document).scrollLeft();			  actY = jQuery(document).scrollTop();				clearInterval(scrollInt);				scrollInt = setInterval('setScroll()', 20);			});		}	});}function setScroll(){	actY += (tarY - actY) / 6;	actX += (tarX - actX) / 6;	if(Math.abs(tarX - actX) < 2 && Math.abs(tarY - actY) < 2){		clearInterval(scrollInt);	}	scrollTo( Math.round(actX), Math.round(actY));}function blankToPop () {	jQuery('a.commonPop').each(function(){		$(this).removeAttr("target");		$(this).attr('popURL', this.href);		( $(this).attr("rel") ? "" : $(this).attr("rel","") );		this.href = "javascript:;";		$(this).click(function () {			eval("commonPop('"+$(this).attr("popURL")+"',"+$(this).attr("rel")+")");		});	});}/*	USER FUNCTION*///FUNCTION commonPop//pFile = popup File//pWidth = popup Width [optional]//pHeight = popup Height [optional]//pStatus = popup Features[optional]function commonPop(pFile, pWidth, pHeight,pStatus){	//var fName = pFile.substring(pFile.lastIndexOf('/')+1, pFile.length);	var wName = "";	if(pWidth == null){ pWidth = 700}	if(pHeight == null){ pHeight = 600}	if(pStatus == null){ pStatus = 'yes';}	if(pWidth > screen.availWidth){		pWidth = screen.availWidth;		pStatus = 'yes';	}	if(pHeight > screen.availHeight-50){		pHeight = screen.availHeight-50;		pStatus = 'yes';	}	var wFeatures= 'menubar=no,scrollbars='+pStatus+',resizable='+pStatus+',width='+pWidth+',height='+pHeight;	void(window.open(pFile, wName, wFeatures));}//FUNCTION commonPop2//pFile = popup File//pWidth = popup Width [optional]//pHeight = popup Height [optional]//pStatus = popup Features[optional]function commonPop2(pFile, pWidth, pHeight,pStatus){	//var fName = pFile.substring(pFile.lastIndexOf('/')+1, pFile.length);	var wName = "";	if(pWidth == null){ pWidth = 700}	if(pHeight == null){ pHeight = 600}	if(pStatus == null){ pStatus = 'yes';}	if(pWidth > screen.availWidth){		pWidth = screen.availWidth;		pStatus = 'yes';	}	if(pHeight > screen.availHeight-50){		pHeight = screen.availHeight-50;		pStatus = 'yes';	}	var wFeatures= 'toolbar=yes,location=yes,directories=yes,status=no,menubar=yes,scrollbars='+pStatus+',resizable='+pStatus+',width='+pWidth+',height='+pHeight;	void(window.open(pFile, wName, wFeatures));}function fundopen(fundId){	var pFile = rootPath()+"fund/FundFrame.php?fund="+fundId+"&page=0";	var wName = fundId;	var pWidth = 800;	var pHeight = 700;	var pStatus = 'yes';	if(pWidth > screen.availWidth){		pWidth = screen.availWidth;		pStatus = 'yes';	}	if(pHeight > screen.availHeight-50){		pHeight = screen.availHeight-50;		pStatus = 'yes';	}	var wFeatures= 'toolbar=yes,location=yes,directories=yes,status=no,menubar=yes,scrollbars='+pStatus+',resizable='+pStatus+',width='+pWidth+',height='+pHeight;	void(window.open(pFile, wName, wFeatures));}function openWindowCommo6(){	var pFile =rootPath()+"video/COMMODITY6/index.html";	var wName = "commodity6";	var pWidth = 880;	var pHeight = 650;	var pStatus = 'no';	if(pWidth > screen.availWidth){		pWidth = screen.availWidth;		pStatus = 'yes';	}	if(pHeight > screen.availHeight-50){		pHeight = screen.availHeight-50;		pStatus = 'yes';	}	var wFeatures= 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+pStatus+',resizable='+pStatus+',width='+pWidth+',height='+pHeight;	void(window.open(pFile, wName, wFeatures));	return true;}function openWindowMatu(pFiles){	var pFile =rootPath()+"dat/"+pFiles;	var wName = "matu";	var pWidth = 600;	var pHeight = 200;	var pStatus = 'no';	if(pWidth > screen.availWidth){		pWidth = screen.availWidth;		pStatus = 'yes';	}	if(pHeight > screen.availHeight-50){		pHeight = screen.availHeight-50;		pStatus = 'yes';	}	var wFeatures= 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+pStatus+',resizable='+pStatus+',width='+pWidth+',height='+pHeight;	void(window.open(pFile, wName, wFeatures));}//FUNCTION moveOpener//pFile = filefunction moveOpener(pFile){	if(opener){		void(opener.location.href = pFile);	}else{		void(document.location.href = pFile);	}}//FUNCTION AS externalInterfacefunction AS (str) {	if(jQuery.browser.msie){		return window[str];	}else{		return document[str];	}}function blankConfirm () {	jQuery("a[target='_blank']").each(function(){		var expr = new RegExp("(.*)://(/?)(.*?)/");		var h = this.href;		var hArr = h.match(expr);		var l = location.href;		var lArr = l.match(expr);		if(hArr[0] != lArr[0]) {			var str = h.replace(/\?/g, "%3F");			$(this)				.click(					function(){						OpenLinkWindow($(this).attr("dhref"));					}				)				.attr("dhref",$(this).attr("href"))				.attr("href","javascript:void(0)")				.removeAttr("target")			.end();		}	})}//FUNCTION blankLogToGooglefunction blankLogToGoogle (str) {	jQuery("a[target='_blank']").each(function(){		var expr = new RegExp("(.*)://(/?)(.*?)/");		var h = this.href;		var hArr = h.match(expr);		var l = location.href;		var lArr = l.match(expr);		if(hArr[0] != lArr[0]) {			var str = h.replace(/\?/g, "%3F");			$(this).click(				function(){ pageTracker._trackPageview('/blank/?'+str) }			);		}	})}/* feedreader */function loadRSS (rssURL, category) {	$.ajax({		dataType: "text",		data: {},		//cache: true,		url: rssURL,		success: function (res) {			var objTree = new XML.ObjTree();			var dataObj = objTree.parseXML(res);			if(dataObj.rss.channel.item){				var isArray = false;				for (var i in dataObj.rss.channel.item) {					var item = dataObj.rss.channel.item[i];					if(item.title != undefined) {						addList(item,category);						isArray = true;					}				}				if(!isArray){					addList(dataObj.rss.channel.item,category);				};			}			flag++;			if(flag == loadRSSNum) writeRSS();		}	});}function addList (item,category) {	var d = new Date(Date.parse(item.pubDate));	var timestamp = d.getTime();	var dYear = ($.browser.msie ? d.getYear() : d.getYear()+1900);	var dMonth = d.getMonth()+1;	var dDay = d.getDate();	var date = (dYear+"/"+dMonth+"/"+dDay );	var itemObj = {		title : item.title,		description : item.description,		timestamp : timestamp,		date : date,		cat : category,		topics_no : item.topics_no	}	listCache.push(itemObj);}function writeRSS () {	listCache.sort(function(a,b){		return (b.timestamp - a.timestamp)+(b.topics_no-a.topics_no) ;	});	var maxLen = Math.min(rssDispNum,listCache.length);	for( var i = 0; i < maxLen; i++){		var item = listCache[i];		var listObj = document.createElement("LI");		var title = document.createElement("SPAN");		$(title)			.addClass("title")			.addClass("on")			.addClass(item.cat)			.html(item.title)			.appendTo(listObj)			.click(function(){				$(this)					.removeClass("ov")					.parent()						.find(".description")							.each(function(){								if($(this).attr("status") != "open") {									$(this).attr("status","open");									$(this).parent().find(".title").removeClass("on");								}else{									$(this).attr("status","close");									$(this).parent().find(".title").addClass("on");								}								$(this).toggle();							})						.end()					.end()				.end();			})			.hover(				function(){ $(this).addClass("ov"); },				function(){ $(this).removeClass("ov"); }			)		.end();		var description = document.createElement("SPAN");		$(description)			.addClass("description")			.html(item.description)			.appendTo(listObj)		.end();		document.getElementById("feed").appendChild(listObj);	}}//FUNCTION SEO‘Îôvar menu = new Array();var blnOpen = false;function showFilter(obj) {	if (  blnOpen == false ) {		return;	}	if ( typeof( menu[ obj ] ) != "object" ) {		return;	}	menu[obj].style.display = "block";	menu[obj].style.visibility = "visible";}function showHide(obj) {	if (  blnOpen == false ) {		return;	}	if ( typeof( menu[ obj ] ) != "object" ) {		return;	}	menu[obj].style.visibility = "hidden";	menu[obj].style.display = "none";}function menuBarInit() {   	menu = document.getElementsByTagName("div");	blnOpen=true;}