
//prelodery
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = true;
function preloadImages() {
	if (document.images) {
		//s = newImage("s.gif");
		buttongraph1 = newImage("../img/section2/button-graph1-on.gif");
		buttongraph2 = newImage("../img/section2/button-graph2-on.gif");
		buttongraph3 = newImage("../img/section2/button-graph3-on.gif");
		buttongraph4 = newImage("../img/section2/button-graph4-on.gif");
		buttongraph1faq = newImage("../img/section6/button-graph1-on.gif");
		preloadFlag = true;
	}
}


function file_dirname(str)
{
	return str.substr(1,str.lastIndexOf("/"));
}

function file_basename(str)
{
	return str.substr(str.lastIndexOf("/")+1);
}

function file_getExtension(fileN) {
	var lastPos; var pos;
	pos=fileN.indexOf(".");
	lastPos=pos;
	
	while (pos != -1) {   
		pos=fileN.indexOf(".",pos+1);
		if (pos != -1) lastPos = pos;
	}
	return fileN.substring(lastPos + 1);
}

function getSWFCode(imageFileName, imagesFolder, imageWidth, imageHeight) {
	widthCode	= ' width="'+imageWidth+'"';
	heightCode	= ' height="'+imageHeight+'"'; 

	code = "<OBJECT classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" ";

	if (imageWidth)	 code += widthCode;
	if (imageHeight) code += heightCode;
	
	code +="><PARAM NAME=movie VALUE=\""+imagesFolder+"/" + imageFileName + "\"><PARAM NAME=\"quality\" VALUE=\"high\"> <PARAM NAME=\"bgcolor\" VALUE=\"#FFFFFF\"><PARAM NAME=\"wmode\" VALUE=\"transparent\"> <EMBED src=\""+imagesFolder+"/" + imageFileName + "\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#FFFFFF\" ";
	
	if (imageWidth)	 code += widthCode;
	if (imageHeight) code += heightCode;

	code +=" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></OBJECT>";
	return code;
}


function showSWF(imageFileName, imagesFolder, imageWidth, imageHeight, divName) {
	var so = new SWFObject(imagesFolder+"/" + imageFileName, divName+'SWF', imageWidth, imageHeight, "8");
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");

	so.write(divName);
}

var noFlash = false;

function showImage(imageFileName, imagesFolder, imageWidth, imageHeight){
	imagesFolder = file_dirname(imageFileName);
	imageFileName = file_basename(imageFileName);
		
	if (imageFileName == 's.gif') {imageFileName = 's.gif';imagesFolder = '';}
	isFlash = (file_getExtension(imageFileName).toUpperCase() == 'SWF');
	if (isFlash && flashversion>=6) {
		var imgText = getSWFCode(imageFileName, imagesFolder, imageWidth, imageHeight);
	} else {
		if (isFlash) {imageFileName +='.png';noFlash = true;}

		var imgText = "<img border=\"0\" src=\""+imagesFolder+"/" + imageFileName + "\""
		if (imageWidth)	imgText += " width=\""+imageWidth+"\"";
		if (imageHeight) imgText += " height=\""+imageHeight+"\"";
		imgText += " alt=\"\" />";
	}
	
	document.write(imgText);
}

function showImage2(imageFileName, imagesFolder, imageWidth, imageHeight){
	imagesFolder = file_dirname(imageFileName);
	imageFileName = file_basename(imageFileName);
		
	if (imageFileName == 's.gif') {imageFileName = 's.gif';imagesFolder = '';}
	isFlash = (file_getExtension(imageFileName).toUpperCase() == 'SWF');
	if (isFlash && flashversion>=6) {
		var imgText = showSWF(imageFileName, imagesFolder, imageWidth, imageHeight);
	} else {
		if (isFlash) {imageFileName +='.png';noFlash = true;}

		var imgText = "<img border=\"0\" src=\""+imagesFolder+"/" + imageFileName + "\""
		if (imageWidth)	imgText += " width=\""+imageWidth+"\"";
		if (imageHeight) imgText += " height=\""+imageHeight+"\"";
		imgText += " alt=\"\" />";

		document.write(imgText);
	}
}



//email
function writeEmail(email_mailbox, email_host, email_show, email_class) 
{
	// protected email script by Joe Maller
	// JavaScripts available at http://www.joemaller.com
	// this script is free to use and distribute
	// but please credit me and/or link to my site
	// Function created by Michal Borychowski
	emailE=(email_mailbox + '@' + email_host);
	if (!email_show) email_show = emailE;
	if (email_class) email_class = ' class="'+email_class+'"'
	else email_class = '';
	document.write('<a' + email_class + ' href="mailto:' + emailE + '">' + email_show + '</a>');
}

function showQEngine() {
	//window.open('_taryfikator/quote_engine_6_v4.html','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=646,height=560,screenX=150,screenY=150,top=150,left=150')
	window.open('http://www.axa.pl/quote/index.aspx','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=646,height=440,screenX=150,screenY=150,top=150,left=150')
}



