var xmlHttp;
function GetXmlHttpObject(){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) objXMLHttp=new XMLHttpRequest();
	else if (window.ActiveXObject)	objXMLHttp=new ActiveXObject('Microsoft.XMLHTTP');
	return objXMLHttp;
}
function share_show(){
	xmlHttp=GetXmlHttpObject();
	xmlHttp.onreadystatechange=changed_share_show;
	xmlHttp.open('GET','../inner/share_form.php?hash='+Math.random() ,true);
	xmlHttp.send(null);
	return false;
}
var s_action="hide";
function toggle_share(){
	if(s_action=="hide"){share_show();s_action="show";}
	else {share_close();s_action="hide";}
}
function changed_share_show() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete'){
		document.getElementById('sharewrap').innerHTML = xmlHttp.responseText;
	}	 
}
function share_close(){
	document.getElementById("share_bx").style.display="none";
}
function share_this(site){
	  exHed=encodeURIComponent("ISIS Financial System");
	  exDek=encodeURIComponent("Investment Management System (IMS) is a powerful portfolio-management and accounting solution that utilizes state-of-the-art technology to deliver a superior solution for asset managers, mutual funds, insurance companies and pension plans.");
	  exURL=escape("http://isisfs.com");
	  shareArticle(site);
}
function shareArticle(site){
	switch (site) {
		case "digg":
			OpenPop('http://digg.com/remote-submit?phase=2&url='+exURL+'&title='+exHed+'&bodytext='+exDek,'digg','toolbar=no,resizable=yes,scrollbars=yes,width=850,height=500');
			break;		
		case "newsvine":
			OpenPop('http://www.newsvine.com/_wine/save?ver=2&popoff=0&aff=ibtimes&t=' + keywords + '&e=' + exDek + '&h=' + exHed + '&u=' + exURL, 'newsvine', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "delicious":
			OpenPop('http://del.icio.us/post?v=4&noui&jump=close&url='+exURL+'&title='+exHed+'&notes='+exDek+'&tags='+keywords, 'delicious','toolbar=no,resizable=yes,scrollbars=yes,width=850,height=500');
			break;		
		case "facebook":
			OpenPop('http://www.facebook.com/sharer.php?u=' + exURL + '&t=' + exHed, 'facebook', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "stumbleupon":
			OpenPop('http://www.stumbleupon.com/submit?url=' + exURL + '&title=' + exHed, 'stumbleupon', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "yahoo":
			OpenPop('http://buzz.yahoo.com/submit?submitUrl=' + exURL + '&submitHeadline=' + exHed+ '&submitSummary=' + exDek, 'yahoo', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "myspace":
			OpenPop('http://www.myspace.com/Modules/PostTo/Pages/?u=' + exURL + '&t=' + exHed+ '&c=' + exDek, 'myspace', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "google":
			OpenPop('http://www.google.com/bookmarks/mark?op=add&bkmk=' + exURL + '&title=' + exHed+ '&annotation=' + exDek, 'google', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "reddit":
			OpenPop('http://www.reddit.com/submit?url=' + exURL + '&title=' + exHed, 'reddit', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;		
		case "linkedin":
			OpenPop('http://www.linkedin.com/shareArticle?mini=true&url=' + exURL + '&title=' + exHed+ '&summary=' + exDek, 'linkedin', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "technorati":
			OpenPop('http://technorati.com/faves/inistone?add=' + exURL, 'technorati', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "yahoobookmk":
			OpenPop('http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=' + exURL+'&t='+ exHed, 'yahoobookmk', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "mixx":
			OpenPop('http://www.mixx.com/submit?page_url=' + exURL+'&t='+ exHed, 'mixx', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "yahoomyweb":
			OpenPop('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + exURL+'&t='+ exHed, 'yahoomyweb', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "propeller":
			OpenPop('http://www.propeller.com/submit/?U=' + exURL+'&T='+ exHed, 'propeller', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "propeller":
			OpenPop('http://www.propeller.com/submit/?U=' + exURL+'&T='+ exHed, 'propeller', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "windowslive":
			OpenPop('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=' + exURL+'&title='+ exHed+'&top=1', 'windowslive', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "friendfeed":
			OpenPop('http://friendfeed.com/share?url=' + exURL+'&title='+ exHed, 'friendfeed', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "furl":
			OpenPop('http://furl.net/storeIt.jsp?u=' + exURL+'&t='+ exHed, 'furl', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "xanga":
			OpenPop('http://www.xanga.com/private/editorx.aspx?u=' + exURL+'&t='+ exHed+'&s='+ exDek, 'xanga', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
		case "blinklist":
			OpenPop('http://blinklist.com/index.php?Action=Blink/addblink.php&Url=' + exURL+'&Title='+ exHed, 'blinklist', 'toolbar=0,status=0,height=500,width=850,scrollbars=yes,resizable=yes');
			break;
	}
}
function OpenPop(url, name, params) {
	var win = window.open(url, name, params);
}

function CreateBookmarkLink(val) { 
	var appname = navigator.appName;
	var b_url = "http://www.ibtimes.com/"; 
	var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

	if (appname == "Microsoft Internet Explorer") { 
		val.style.behavior='url(#default#homepage)'; 
		val.setHomePage(b_url);
	} else if (isKonq) {
		alert('Please press CTRL + B to bookmark our site.');
	} else if (isSafari) {
		 alert('Please press '+buttonStr+' + D to bookmark our site.');
	} else if (isMac) {
		alert('Please press Command/Cmd + D to bookmark our site.'); 
	} else { 
		window.sidebar.addPanel(document.title, b_url,""); 
	} 
}

function show(val) {
	for (i=1;i<3 ;i++ ) {
		if (i == val){
			if (document.getElementById('tab'+val).style.display == "block") {
				document.getElementById('tab'+val).style.display = "none";
			} else {
				document.getElementById('tab'+val).style.display = "block";
			}
		} else {
			document.getElementById('tab'+i).style.display = "none";
		}
	}
}