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.Mozilla = (this.Gecko && ua.indexOf('gecko/') + 14 == ua.length);
	this.Firefox = ( (ua.indexOf('firebird/') != -1) || (ua.indexOf('firefox/') != -1) );
	this.NS = ( (this.Gecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.Opera && !this.Safari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -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.Win32 = (this.Win && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
	this.Mac = (ua.indexOf('mac') != -1);

	this.NS4 = (this.NS && this.versionMajor == 4);
	this.NS6x = (this.NS && this.versionMajor == 6);
	this.NS6up = (this.NS && this.versionMajor >= 6);
	this.NS7x = (this.NS && this.versionMajor == 7);
	this.NS7up = (this.NS && this.versionMajor >= 7);

	this.IE4 = (this.IE && this.versionMajor == 4);
	this.IE4up = (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();

function mover(I) {
	document.getElementById(I).src='/i/tm_0'+I.substring(2,4)+'_0'+2+'.gif';
}

function mout(I) {
	document.getElementById(I).src='/i/tm_0'+I.substring(2,4)+'_0'+1+'.gif';
}

function isDefined(property) {
	return (typeof property != 'undefined');
}

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';
		doc += 'On Error Resume Next \n';
		doc += 'Dim obFlash \n';
		doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
		doc += '	Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
		doc += '	If IsObject(obFlash) Then \n';
		doc += '		flashVersion = i \n';
		doc += '		Exit For \n';
		doc += '	End If \n';
		doc += 'Next \n';
		doc += '</scr' + 'ipt\> \n';
		document.write(doc);
	}
	else{
		flashVersion = flashVersion_DONTKNOW;
	}

return flashVersion;

}
flashVersion_DONTKNOW = -1;

function FlashObject(){
	this.maxVersion;
	this.SwfFile;
	this.noFlashRedirect;

	this.minVersion;
	this.altSwfFile;

	this.altImage;
	this.altImageAddAtribute;
	this.altImageHTML;

	this.width;
	this.height;
	this.menu;
	this.background;
}

FlashObject.prototype.rnd=function(){
	this.ranNum= Math.random()*64;
    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="http://download.macromedia.com/pub/shockwave/cabs/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="http://download.macromedia.com/pub/shockwave/cabs/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{
		if (this.noFlashRedirect != undefined && this.noFlashRedirect != null){
			self.resizeTo(570,360);
			self.location.href=this.noFlashRedirect;
		}
		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 fixSize(){

	if (document.getElementById('scont')) {
		var scontHeight = document.getElementById('scont').offsetHeight;
	}
	if (document.getElementById('mid')) {
		var midHeight = document.getElementById('mid').offsetHeight;
	}
	if (document.getElementById('lmenu')) {
        var lmenuHeight = document.getElementById('lmenu').offsetHeight;
	}
	if (document.getElementById('left')) {
		var leftHeight = document.getElementById('left').offsetHeight;
	}

	
	if (midHeight > leftHeight)
	{
		if (is.Firefox)
		{
			document.getElementById('left').style.height  =  (midHeight-171) +"px";
		} else {
			document.getElementById('left').style.height  =  (midHeight-171) +"px";
		}

		document.getElementById('scont').style.height  =  (midHeight+5) +"px";

	}

	if (leftHeight > midHeight) 
	{
		document.getElementById('mid').style.height  =  (leftHeight-35) +"px";
		if (document.getElementById('scont'))
		{
			document.getElementById('scont').style.height  =  (leftHeight+5) +"px";
		}
	}



	if ((lmenuHeight < 296) && (leftHeight > 296))
	{
		if (is.Firefox)
		{
			document.getElementById('lmenu').style.height  =  leftHeight-30 +"px";
			if ((leftHeight > scontHeight) && (leftHeight >= midHeight))
			{
				document.getElementById('scont').style.height  =  (leftHeight+170) +"px";
			}else {
				document.getElementById('scont').style.height  =  (midHeight+100) +"px";
			}


		} else {
			document.getElementById('lmenu').style.height  =  leftHeight +"px";
			leftHeight = document.getElementById('left').offsetHeight;

			if ((leftHeight > scontHeight-100))
			{
				document.getElementById('scont').style.height  =  (leftHeight+120) +"px";
			}


		}

	}


}


function init(){
if (typeof document.body.style.maxHeight != "undefined") {

} else {
	if ((!is.IE4  || !is.NS4) && (is.IE5 || is.IE55 || is.IE6up || is.NS6 || is.Safari ||is.Firefox)){
		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].title = aArray[i].childNodes[0].nodeValue;
			}
	}
}
}


function getExternalLinks() {
	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 PopItUp(src,w,h,s) {
	if(s) w=w+17;
	Popwin = window.open(src,"popwin","toolbar=0,width=" + w + ",height=" + h + ",location=0,directories=0,status=0,scrollbars="+s+",menubar=0,resizable=0,copyhistory=1");
	Popwin.focus();
	return false;
}

function PopGallery(src,w,h,s) {
	if(s) w=w+17;
	Popwin = window.open(src,"popwin","toolbar=0,width=" + w + ",height=" + h + ",location=0,directories=0,status=0,scrollbars="+s+",menubar=0,resizable=0,copyhistory=0");
	Popwin.focus();
}

function PopItUpSearch(src,w,h,s) {
	if(s) w=w+17;
	Popwin = window.open(src,"popwin","toolbar=0,width=" + w + ",height=" + h + ",location=0,directories=0,status=0,scrollbars="+s+",menubar=0,resizable=0,copyhistory=1");
	Popwin.focus();
}

function PopItUpC(src){
	/*
	Popwin = window.open(src,"popwin","toolbar=0,width=640,height=560,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,copyhistory=1");
	Popwin.focus();
	return false;
	*/
}

window.onload=function(){
	fixSize();
	init();
	getExternalLinks();
}

function Pop3D(){
	PopItUp("/production_facilities/3d/default.htm",740,540,0);
}

function mailTo(m,e,t) {
	if (!e) {
		e='mn.com.tr';
	}
	if (!t) {
		t=m+String.fromCharCode(64)+e;
	}
	
	document.write('<a href="mailto:'+m+String.fromCharCode(64)+e+'" class="contentlink">'+t+'</a>');
}
