
function Browser(){
	var ua = navigator.userAgent.toLowerCase(); 
	this.Gecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
	this.Safari = (ua.indexOf('safari') != - 1);
	this.IE = (ua.indexOf('msie') != -1 && !this.Opera && (ua.indexOf('webtv') == -1) ); 
	this.Firefox = ( (ua.indexOf('firebird/') != -1) || (ua.indexOf('firefox/') != -1) );
	this.IECompatible = ( (ua.indexOf('msie') != -1) && !this.IE);
	this.NSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.NS && !this.Mozilla);
	this.geckoVersion = ( (this.Gecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	this.equivalentMozilla = ( (this.Gecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
	this.versionMinor = parseFloat(navigator.appVersion); 
	if (this.Gecko && !this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
	else if (this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
	else if (this.IE && this.versionMinor >= 4) this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	else if (this.Safari) this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
	this.versionMajor = parseInt(this.versionMinor); 
	this.DOM1 = (document.getElementById);
	this.DOM2Event = (document.addEventListener && document.removeEventListener);
	this.mode = document.compatMode ? document.compatMode : 'BackCompat';
	this.Win = (ua.indexOf('win') != -1);
	this.Mac = (ua.indexOf('mac') != -1);
	this.NS6up = (this.NS && this.versionMajor >= 6);
	this.NS7up = (this.NS && this.versionMajor >= 7);
	this.IE4 = (this.IE && this.versionMajor == 4);
	this.IE5 = (this.IE && this.versionMajor == 5);
	this.IE55 = (this.IE && this.versionMinor == 5.5);
	this.IE5up = (this.IE && this.versionMajor >= 5);
	this.IE6x = (this.IE && this.versionMajor == 6);
	this.IE6up = (this.IE && this.versionMajor >= 6);
}
var is = new Browser();

var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 8;
	var agent = navigator.userAgent.toLowerCase(); 
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object'){ 
			for (var i = latestFlashVersion; i >= 3; i--){
	            if (flashPlugin.description.indexOf(i + '.') != -1){
	               flashVersion = i;
	               break;
	            }
			}
		}
	}
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		var doc = ''+
			'<scr' + 'ipt language="VBScript"\> \n'+
			'On Error Resume Next \n'+
			'Dim obFlash \n'+
			'For i = ' + latestFlashVersion + ' To 3 Step -1 \n'+
			'	Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n'+
			'	If IsObject(obFlash) Then \n'+
			'		flashVersion = i \n'+
			'		Exit For \n'+
			'	End If \n'+
			'Next \n'+
			'</scr' + 'ipt\> \n';
		document.write(doc);
	} else {flashVersion = flashVersion_DONTKNOW; }
return flashVersion;
}
var flashVersion_DONTKNOW = -1;
function FlashObject(){
	this.ID=this.ID;
	this.maxVersion=this.maxVersion;
	this.SwfFile;
	this.minVersion;
	this.altSwfFile;
	this.altImage;
	this.altImageAddAtribute;
	this.altImageHTML;
	this.width;
	this.height;
	this.menu;
	this.background;
	this.wmode;
	this.flashvars;
	this.scale;
	this.salign;
}
FlashObject.prototype.rnd=function(){
	this.ranNum= Math.random()*255;
    return this.ranNum;
}
FlashObject.prototype.embed=function(){
	var buff;
	if(getFlashVersion()>=this.maxVersion){
		
		buff=''+
			'<OBJECT ID="'+this.ID+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://www.finansonline.com/_flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.SwfFile+'"><PARAM NAME=menu VALUE='+this.menu+'><param name="wmode" value="'+this.wmode+'"><PARAM NAME="quality" VALUE="high"><PARAM NAME="flashvars" VALUE="'+ this.flashvars +'"><PARAM NAME="bgcolor" VALUE="'+this.background+'"><PARAM NAME="scale" VALUE="'+this.scale+'"><PARAM NAME="salign" VALUE="'+this.salign+'">'+
				'<EMBED name="'+this.ID+'" src="'+this.SwfFile+'" menu="'+this.menu+'" wmode="'+this.wmode+'" quality="high" bgcolor="'+this.background+'"  WIDTH="'+this.width+'" HEIGHT="'+this.height+'" scale="'+this.scale+'" salign="'+this.salign+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true"></EMBED>'+
			'</OBJECT>';
	}else if((getFlashVersion()> this.minVersion) && (getFlashVersion()< this.maxVersion) && this.altSwfFile){
		
		buff=''+
			'<OBJECT ID="'+this.ID+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://www.finansonline.com/_flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.altSwfFile+'"><PARAM NAME=menu VALUE='+this.menu+'<param name="wmode" value="'+this.wmode+'">><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE='+this.background+'>'+
				'<EMBED flashvars="'+ this.flashvars +'" name="'+this.ID+'" src="'+this.altSwfFile+'" menu="'+this.menu+'" wmode="'+this.wmode+'" quality=high bgcolor='+this.background+'  WIDTH='+this.width+' HEIGHT='+this.height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true"></EMBED>'+
			'</OBJECT>';
	}else{
		this.altImageAddAtribute ? (buff='<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" '+this.altImageAddAtribute+' />'+this.altImageHTML) : (buff='<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" />');
	}
	document.write(buff);
}



function init(){
	if (!document.getElementsByTagName) return;
	imgArray = document.getElementsByTagName("img");
		for (i=0;i<imgArray.length;i++){
			if(imgArray[i].alt!=-1) imgArray[i].title=imgArray[i].alt;
		}
	aArray = document.getElementsByTagName("a");
		for (i=0;i<aArray.length;i++){
			if(aArray[i] && aArray[i].href && !aArray[i].title && aArray[i].childNodes[0])	aArray[i].title = aArray[i].childNodes[0].nodeValue;
		}
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank";
		}
	}
}


function getCenter(pwidth,pheight){
	wwidth=screen.width;
	wheigth=screen.height;
	lpos= (wwidth - pwidth)/2;
	tpos= (wheigth - pheight)/2;
	return lpos, tpos;
}


function PopItUp(src,w,h,s) {
	if(s) w=w+17;
	getCenter(w,h);
	Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=1, copyhistory=0");
	Popwin.focus();
	//return false;
}

function PopItUpReturn(src,w,h,s) {
	if(s) w=w+17;
	getCenter(w,h);
	Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=0, copyhistory=0");
	Popwin.focus();
	return false;
}

function getUrl(obj){
	selectedObj=obj.options[obj.selectedIndex];
	document.location.href=selectedObj.value;
	return true;
}

function getWindowHeight(){
	var windowHeight = 0;
	if(typeof(window.innerHeight) == 'number'){
		windowHeight = window.innerHeight;
	}else{
		if(document.documentElement && document.documentElement.clientHeight){
			windowHeight = document.documentElement.clientHeight;
		}else{
			if(document.body && document.body.clientHeight){
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}


function setFooter(){
	if (document.getElementById){
		var windowHeight = getWindowHeight();
		if (windowHeight>0){
			var contentHeight = document.getElementById('container-page').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight)>= 0) {
				footerElement.style.marginTop = (windowHeight - (contentHeight+footerHeight)) + 'px';
			}else{
				footerElement.style.marginTop = '0';
			}
		}
	}
}



window.onload = function() {
	initMenu();
	init();
	externalLinks();
	alignTPart();

	//setFooter();
}

window.onresize = function() {
	//setFooter();
}

function mailTo(m,e) {
	if (!e) {
		e='finansonline.com';
	}
	
	
	document.write('<a href="mailto:'+m+String.fromCharCode(64)+e+'">'+m+String.fromCharCode(64)+e+'</a>');
}

function initMenu() {
	var topmenu = new Menu('top_menu');
}

function Menu(id) {
	var root = document.getElementById(id);
	if(root == null) return;	
	this.intvl;
	this.smh = 1;
	this.selectBoxes=new Array();
	this.search(root);
}


Menu.prototype.search = function(root) {
	var node;
	var i;

	root = root.getElementsByTagName('ul')[0];
	
	for(i=0; i < root.childNodes.length; i++) {
		node = root.childNodes[i];
		
		if(node.nodeName.toUpperCase() != 'LI') {
			continue;
		}
	
		this.addListener(node);
		
		if(node.childNodes.length > 2) {
			this.search(node);
		}
	}
}

Menu.prototype.addListener = function(node) {
	var obj = this;
	
	node.onmouseover = function() {
		/*clearTimeout(this.intvl);
		if(this.className.indexOf('this') > -1) {
			return false;
		}*/
		var cls = this.className.split(' ');
		cls[cls.length] = 'this';
		this.className = cls.join(' ');
		
		
		/*if(this.childNodes.length > 2) {
			this.getElementsByTagName('div')[0].style.display = 'block';
		}*/
		
		
		if(this.childNodes.length > 2 && !this.w) {
			obj.setWidth(this);
		} else {
			this.w = 1;
		}

		obj.selectMenuHack(0);
	};
	
	node.onmouseout = function() {
		obj.hide(this);
		/*
		if(is.IE) {
			obj.hide(this);
		} else {
			this.intvl = setTimeout(obj.hide, 100, this);
		}*/
		obj.selectMenuHack(1);
	};
}

function hide(node) {
	topmenu.hide(node);
}

Menu.prototype.hide = function(node) {
	var cls = node.className.split(' ');
	
	cls.pop();
	if(node.w) {
		/*if(node.childNodes.length > 2) {
			node.getElementsByTagName('div')[0].style.display = 'none';
		}*/
		node.className = cls.join(' ');
	}
}

Menu.prototype.setWidth = function(root) {
	var node;
	var w = 0;
	var arr_ul;
	var mroot = root;
	var mar = 0;
	var ul;

	root = root.getElementsByTagName('ul')[0];
	w = root.attributes.width.nodeValue;

	/*
	for(i=0; i < root.childNodes.length; i++) {
		node = root.childNodes[i];
		
		if(node.nodeName == '#text') {
			continue;
		}
		
		node = node.getElementsByTagName('a')[0];
		
		if(node.offsetWidth > w) {
			w = node.offsetWidth;
		}
	}*/
	
	for(i=0; i < root.childNodes.length; i++) {
		node = root.childNodes[i];
		
		if(node.nodeName == '#text') {
			continue;
		}
		
		node = node.getElementsByTagName('a')[0];
		
		node.style.width = w+'px';
	}
	
	arr_ul = root.getElementsByTagName('div');
	w = root.offsetWidth;

	for(i=0; i < arr_ul.length; i++) {
		node = arr_ul[i];
		if(node.className == 'cont') {
			if(node.style.left && !mar) {
				w += parseInt(node.style.left);
				mar = 1;
			}
			/*
			ul = node.getElementsByTagName('ul')[0];
			
			if(ul.attributes.align && ul.attributes.align.nodeValue == 'left') {
				w = -ul.attributes.width.nodeValue-30;
			}*/
			ul = node.parentNode;
			
			if(ul.className == 'left') {
				ul = node.getElementsByTagName('ul')[0];
				w = -ul.attributes.width.nodeValue-30;
				node.getElementsByTagName('div')[0].style.left = -w+'px';
			}
			
			node.style.left = w+'px';
		}
	}
	
	mroot.w = 1;
}

Menu.prototype.selectMenuHack = function(t) {
	var selects = document.getElementsByTagName('select');
	
	if (this.smh != t) {
		for (s=0;s<selects.length;s++) {
			if (t==1) {
				selects[s].style.display=this.selectBoxes[s];
			} else {
				this.selectBoxes[s]=selects[s].style.display;
				selects[s].style.display="none";
			}
		
			//selects[s].style.display = (t == 1 ? "":"none");
		}
		this.smh = t;
	}
}
	
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}



function ajandaDetayGoster(gelen, detayDiv){
	
	if (document.all) {//IE 
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Good Browsers
		x = evt.pageX;
		y = evt.pageY;
	}
	document.getElementById(detayDiv).style.display="block";
	document.getElementById(detayDiv).style.left = (x + 6 ) + "px";
	document.getElementById(detayDiv).style.top = (y - 10 ) + "px";
}

function ajandaDetayGizle(detayDiv){
document.getElementById(detayDiv).style.display="none";
}

function ImgRestore() { //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 loadImages() { //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=loadImages.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 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function alignTPart(){
	var maxHeight = 0; 
	var rootTable = document.getElementById("tabContentTable");
	if (typeof(rootTable)!=  "undefined"){
		try
		{
			var rootTableTR = rootTable.rows;
			for (i=0;i<rootTableTR.length;i++){
				rootTableTD = rootTableTR[i].cells;
				maxHeight = 0;
				for (j=0;j<rootTableTD.length;j++){
					var tpartDiv = rootTableTD[j].getElementsByTagName("div")[0]
					if (typeof(tpartDiv) != "undefined" ){				
						var tpartTable = tpartDiv.getElementsByTagName("table")[0]
						if (typeof(tpartTable) != "undefined" ){
							if (tpartTable.rows[1].cells[0].offsetHeight > maxHeight) maxHeight = tpartTable.rows[1].cells[0].offsetHeight;
						}
					}						
				}
				
				for (j=0;j<rootTableTD.length;j++){
					var tpartDiv = rootTableTD[j].getElementsByTagName("div")[0]
					if (typeof(tpartDiv) != "undefined" ){				
						var tpartTable =tpartDiv.getElementsByTagName("table")[0]										
						if (typeof(tpartTable) != "undefined" ){
							tpartTable.rows[1].cells[0].style.height= maxHeight + "px";
							tpartTable.rows[1].cells[0].style.verticalAlign="top";
							tpartTable.rows[1].cells[0].style.paddingTop="0px";
							tpartTable.rows[1].cells[0].style.paddingBottom="0px";	
						}		
					}					
				}

			}
		}
		catch(err)
		{
		//
		} 
	}
}
