﻿var myOrientArr = new Array();

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 = 25;
	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="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{
		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 extWin(src){
	ExtWin = window.open(src);
	ExtWin.focus();
	return false;
}

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=0, 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 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 subContentElement = document.getElementById('sub_content');
			var subContentHeight = document.getElementById('sub_content').offsetHeight;
			var navigationHeight = document.getElementById('navigation').offsetHeight;
			var menuHeight = document.getElementById('menuarea').offsetHeight;
			var headHeight = document.getElementById('headarea').offsetHeight;
			var contentHeightE = document.getElementById('content');
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			
			var wrapperHeight = subContentHeight + menuHeight + headHeight;
			var naviDifCont = navigationHeight - subContentHeight;
			var winDifCont = windowHeight - (wrapperHeight + footerHeight);
			
			if (winDifCont > 0) {
			       //alert("naviDifCont::"+naviDifCont+" winDifCont::"+winDifCont)
				if (naviDifCont > winDifCont){
				    
				     contentHeightE.style.paddingBottom = naviDifCont + 'px';
				}else {
				    contentHeightE.style.paddingBottom = winDifCont + 'px';
				}
			}else if (navigationHeight >= subContentHeight){
				contentHeightE.style.paddingBottom = naviDifCont + 'px';
				
			}else {
			    contentHeightE.style.paddingBottom = '0';
			}
		}
	}
}


//window.onresize = function() {
//	setFooter();
//}


function $(_id){return document.getElementById(_id);}

var exObj="";
var exClickObj="";
var selecterFlag=0;

function showHideElement(_elm, clickObj){
	var myElement = $(_elm);
	var windowHeight = getWindowHeight();
	if (myElement){
		if (myElement.style.display == ""){
			myElement.style.display = "none";
		}
		else{
			myElement.style.display = "";
		}
	}
	
	if(exObj!="" && exObj != _elm){
		$(exObj).style.display = "none";
	}
	
	if(exObj != _elm){
		exObj = _elm;
	}
	
	if (exClickObj != ""){	
		exClickObj.className = "subpage_content_links";
	}
	if (clickObj){
		if (clickObj != exClickObj){
			selecterFlag=1;
		}
		else{
			if (selecterFlag==1){selecterFlag=0;}
			else{selecterFlag=1;}
		}
					
		if (selecterFlag==1){
			clickObj.className += "_on";
		}
		
		exClickObj = clickObj;
	}
}


function loadHideElement(_link){
	mydiv = _link.split("#");
	if (mydiv.length > 1){
		showHideElement(mydiv[1],$(mydiv[1]))
	}
}



function menu_on(_hlm) {
	var myElement = $(_hlm);
		myElement.className += "_on";
}


function menu_off(_hlm) {
	var myElement = $(_hlm);
		myElement.className = _hlm;
}

// SantaFarma JavaScript - main.js



function resizeTd(){
var size_left = document.getElementById('subTab_left').offsetHeight;
var size_right = document.getElementById('subTab_right').offsetHeight;

var leftSize = document.getElementById('sizeLeft').offsetHeight;
var rightSize = document.getElementById('sizeRight').offsetHeight;

var newSize = size_left - leftSize;
var newSize_right = size_right - rightSize;
    

    if(newSize != 0){ document.getElementById('subTab_2_img').height = newSize; }
    else {}
    
    if(newSize_right != 0) { 
    
       if ((is.IE4) || (is.IE5) || (is.IE55)|| (is.IE5up)|| (is.IE6x)|| (is.IE6up)) {
       newSize_right = newSize_right + 10;
       }
    
    document.getElementById('subTab_5_img').height = newSize_right; }
    else {}

}

function trimAll(sString) 
			{
				while (sString.substring(0,1) == ' ')
				{
				sString = sString.substring(1, sString.length);
				}
				while (sString.substring(sString.length-1, sString.length) == ' ')
				{
				sString = sString.substring(0,sString.length-1);
				}
				return sString;
			}

			function submitSearch(){
				obj=document.forms['searchForm'];
				if (!checkKey(obj['aramaInput'],'',1)) {
					return false;
				}
				
				if (trimAll(obj['aramaInput'].value)=="Arama") {
					alert("Lütfen bir arama sözcüğü giriniz.");
					return false;
				}
				
				if (trimAll(obj['aramaInput'].value).length<3) {
					alert("Aradığınız terim en az 3 karakterden oluşmalıdır.");
					return false;
				}
			}

			function checkKey(field,fname,minlength){
				if (field.value.length<minlength){
					alert("Lütfen bir arama sözcüğü giriniz.");
					return (false);
				}
				return (true);
			}


function trimAll_en(sString) 
			{
				while (sString.substring(0,1) == ' ')
				{
				sString = sString.substring(1, sString.length);
				}
				while (sString.substring(sString.length-1, sString.length) == ' ')
				{
				sString = sString.substring(0,sString.length-1);
				}
				return sString;
			}

			function submitSearch_en(){
				obj=document.forms['searchForm'];
				if (!checkKey_en(obj['aramaInput'],'',1)) {
					return false;
				}
				
				if (trimAll_en(obj['aramaInput'].value)=="Search") {
					alert("Please enter a search keyword.");
					return false;
				}
				
				if (trimAll_en(obj['aramaInput'].value).length<3) {
					alert("Your search term must contain at least 3 characters.");
					return false;
				}
			}

			function checkKey_en(field,fname,minlength){
				if (field.value.length<minlength){
					alert("Please enter a search keyword.");
					return (false);
				}
				return (true);
			}		

function selectNav(n, root) {
		var menu_adet = 5;
		var obj = document.images['menu'+n];
		
		var sm = "submenu"+n;
		var s_obj = document.getElementById(sm);
		
		   for(var i =1; i <= menu_adet; i++) {
		   document.images['menu'+i].src = root+'_i/menu/menu'+ i + '.jpg';
		   document.getElementById('submenu'+i).style.display = "none";
		   }
		
		obj.src = root+'_i/menu/menu'+ n + '_o.jpg';
		s_obj.style.display = "block";
	}


function sss(c,t) {
var aktif = "s"+c; // aktive ID
var b = c-1; // item above the active one

   for(var i=1; i<=t ;i++) {
   document.getElementById('s'+i).className="snormal";
   }
   
       if(b!=0) {  
       document.getElementById('s'+b).className="sbefore";
       }

       if(c!=t) {
       document.getElementById(aktif).className="sactive";
       document.getElementById('s'+t).className="slast";
       } else {
       document.getElementById(aktif).className="sactive";
       }

}	
