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 browser = is;

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=8,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=8,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 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) {
	//if (wr == undefined ||wr == null) { wr=""; } else { wr+="/"; }
	getCenter(w,h);
	Popwin = window.open(src,"Popwin","toolbar=0,width="+w+", height="+h+", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars=0, menubar=0, resizable=0, copyhistory=0");
	Popwin.focus();
}

po_Win = {};
function PopItUp_po(src,w,h) {
	getCenter(w,h);
	
	if (po_Win.close) {
	    po_Win.close();
	}
	
	po_Win = window.open(src,"_blank","toolbar=0,width="+w+", height="+h+", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars=0, menubar=0, resizable=0, copyhistory=0");
	po_Win.focus();
}

function playOnline(x) {
	if (x) {
		GP_item = x;
	}
	if (!GP_item || GP_item == "" || GP_item == null || GP_item == undefined) {
		return;
	}
	switch (GP_item) {
		case "efa":
		    PopItUp_po('/Efes_Pilsener/Artemis/default.aspx', 800, 600);
			break;
		case "on":
		    PopItUp_po('/Bayer/TuruncuGuc/default.aspx', 500, 500);
			break;
		case "ifg":
		    PopItUp_po('/Fortis/IdealFamily/default.aspx', 790, 300);
			break;
		case "fblb_1":
		    PopItUp_po('/Fortis/Logo/drive.html', 468, 250);
			break;
		case "fblb_2":
		    PopItUp_po('/Fortis/Logo/wall.html', 468, 250);
			break;
		case "fblb_3":
		    PopItUp_po('/Fortis/Logo/logo.html', 468, 420);
			break;
		case "vettf":
		    PopItUp_po('/Vestel/Veysel/default.aspx', 750, 500);
			break;
		case "dta":
		    PopItUp_po('/GSK/TusOnline/default.aspx', 640, 480);
			break;
		case "da":
		    PopItUp_po('/GSK/DiyabetDunyasi/default.aspx', 600, 460);
			break;
		case "cmiyc":
		    PopItUp_po('/AbdiIbrahim/ErtesiSabah/default.aspx', 740, 480);
			break;
		case "mg":
		    PopItUp_po('/AbdiIbrahim/Unutkanlik/default.aspx', 760, 590);
			break;
		case "aoz":
		    PopItUp_po('/GSK/SigarayiBirak/default.aspx', 780, 550);
			break;
		case "gip":
		    PopItUp_po('/Gulf/Gulf_Racing/default.aspx', 760, 570);
			break;
		case "fkt":
		    PopItUp_po('/GSK/Solunum/default.aspx', 600, 400);
			break;
		case "ftk":
		    PopItUp_po('/Fortis/FTK/default.aspx', 697, 400);
			break;
		case "advbnr":
			PopItUp_po('/Advantage/advBanner.html',482,444);
			break;
		case "advcollectors":
		    PopItUp_po('/Fortis/Logo/logo.html', 697, 400);
			break;
	}
	po_Performance(0);
}

function po_Control() {
	try {
		if (po_Win.document == null) {
			po_Performance(1);
		}
	}
	catch(e) {
		po_Performance(1);
	}
}

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

function po_Performance(t) {
	if (t == 0) {
		document.getElementById("GPFlash").style.display = "none";
		document.getElementById("GPFlash_Paused").style.display = "";
		window.onfocus = po_Control;
	} else {
		document.getElementById("GPFlash").style.display = "";
		document.getElementById("GPFlash_Paused").style.display = "none";
		window.onfocus = null;
	}
}
