function preview(what, w, h, scrollbars) {	
	if (!what) return;	
	if (!w) w = 600;	
	if (!h) h = 400;	
	scrollbars = scrollbars ? 1 : 0;	
	scr_w = screen.width;	
	scr_h = screen.height;	
	l = (scr_w - w) / 2;	
	t = (scr_h - h) / 2;	
	popup = window.open(what, "window_id", "width=" + w + "px,height=" + h + "px,left=" + l + "px,top=" + t + "px,scrollbars=" + scrollbars + ",location=0,toolbar=0,resizable=1,menubar=0,status=0,dependent=1");	
	popup.focus();
}

function popupPage(w,h,URL) {
	var l = 75;
	var t = 75;
	var windowprops = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes" +
	",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
	popup = window.open(URL,"MenuPopup",windowprops);
}

function display_flash(src, width, height, a) {
	if (!window.flash_id) window.flash_id = 1;
	var isIE  = !!(navigator.appVersion.indexOf("MSIE") != -1);
	var isWin = !!(navigator.appVersion.toLowerCase().indexOf("win") != -1);
	var isOpera = !!(navigator.userAgent.indexOf("Opera") != -1);
	var id = window.flash_id ++;
	var r = "";
	if (!a) a = {};
	if (!a.id) a.id = "flash_" + id;
	if (!a.version) a.version = 9;
	if (!a.align) a.align = "middle";
	if (!a.access) a.access = "sameDomain";
	if (!a.quality) a.quality = "high";
	if (!a.background) a.background = "#ffffff";
	if (!a.wmode) a.wmode = "transparent";
	if (!a.scale) a.scale = "noscale";
	if (!a.play) a.play = "true";
	if (!a.loop) a.loop = "true";
	if (!a.menu) a.menu = "true";
	if (!a.salign) a.salign = "";
	if (!a.devicefont) a.devicefont = "false";
	if (!a.fullscreen) a.fullscreen = "false";
	if (isIE && isWin && !isOpera) {
		r += ""
		 + "<object"
		 + " classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\""
		 + " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + a.version + ",0,0,0\""
		 + " width=\"" + width + "\""
		 + " height=\"" + height + "\""
		 + " align=\"" + a.align + "\""
		 + " id=\"" + a.id + "\""
		 + " name=\"" + a.id + "\""
		 + ">"
		 + "<param name=\"movie\" value=\"" + src + "\" />"
		 + "<param name=\"quality\" value=\"" + a.quality + "\" />"
		 + "<param name=\"bgcolor\" value=\"" + a.background + "\" />"
		 + "<param name=\"allowScriptAccess\" value=\"" + a.access + "\" />"
		 + "<param name=\"wmode\" value=\"" + a.wmode + "\" />"
		 + "<param name=\"scale\" value=\"" + a.scale + "\" />"
		 + "<param name=\"play\" value=\"" + a.play + "\" />"
		 + "<param name=\"loop\" value=\"" + a.loop + "\" />"
		 + "<param name=\"menu\" value=\"" + a.menu + "\" />"
		 + "<param name=\"salign\" value=\"" + a.salign + "\" />"
		 + "<param name=\"devicefont\" value=\"" + a.devicefont + "\" />"
		 + "<param name=\"allowFullScreen\" value=\"" + a.fullscreen + "\" />"
		 + "</object>"
		;
	} else {
		r += "<embed"
		 + " src=\"" + src + "\""
		 + " width=\"" + width + "\""
		 + " height=\"" + height + "\""
		 + " align=\"" + a.align + "\""
		 + " name=\"" + a.id + "\""
		 + " quality=\"" + a.quality + "\""
		 + " bgcolor=\"" + a.background + "\""
		 + " allowScriptAccess=\"" + a.access + "\""
		 + " wmode=\"" + a.wmode + "\""
		 + " scale=\"" + a.scale + "\""
		 + " play=\"" + a.play + "\""
		 + " loop=\"" + a.loop + "\""
		 + " menu=\"" + a.menu + "\""
		 + " salign=\"" + a.salign + "\""
		 + " devicefont=\"" + a.devicefont + "\""
		 + " allowFullScreen=\"" + a.fullscreen + "\""
		 + " type=\"application/x-shockwave-flash\""
		 + " pluginspage=\"http://www.macromedia.com/go/getflashplayer\""
		 + "/>"
		;
	}
	return r;
}

function flash_version() {
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins['Shockwave Flash 2.0']) {
			return parseInt(navigator.plugins['Shockwave Flash 2.0'].description.split(" ")[2]);
		} else if (navigator.plugins['Shockwave Flash']) {
			return parseInt(navigator.plugins['Shockwave Flash'].description.split(" ")[2]);
		}
	} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) {
		return 4;
	} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) {
		return 3;
	} else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) {
		return 2;
	} else if ((navigator.appVersion.indexOf("MSIE") != -1) && (navigator.appVersion.toLowerCase().indexOf("win") != -1) && !(navigator.userAgent.indexOf("Opera") != -1)) {
		try {
			return parseInt(((new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")).GetVariable("$version")).split(" ")[1]);
		} catch (e) { }
		try {
			return (new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6")) ? 6 : 0;
		} catch (e) { }
		try {
			return parseInt(((new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3")).GetVariable("$version")).split(" ")[1]);
		} catch (e) { }
		try {
			return (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) ? 2 : 0;
		} catch (e) { }
	}
	return 0;
}

function write_flash(src, width, height, a) {
	document.write(display_flash(src, width, height, a));
}

function display_banner(src, width, height, href, param) {
	document.write(display_flash("/SiteNN/images/flash/place-03.swf?path=" + escape(src) + "&href=" + escape(href) + "&width=" + width + "&height=" + height + (param.scale ? "&scale=" + escape(param.scale) : ""), width, height, param));
}

/* 

	Image Link, multistyle version
	written by Alen Grakalic, provided by Css Globe (cssglobe.com)
	please visit http://cssglobe.com/post/1238/style-your-image-links for more info
	
*/

this.imagelink = function(){
	
	// CONFIG
	
	
	// with multistyle version of this script 
	// you can apply various styles to various images on site
	// the style "groups" consist of 3 elements:
	// 1. css class of images that you wish to apply style to
	// 2. css class that defines how span that covers the image is styled by default
	// 3. css class that defines how span that covers the image is styled when rolled over 
	//
	// use as many varioations as you want, just set the css class to images in html 

	
	// [image css class, covering span default css class, covering span mouseover css class]
	var arr = [			   			  				
				["image1", "", "imageOver"],
				["image2", "imageOut2", "imageOver2"],
				["image3", "", "imageOver3"],
				["image4", "", "imageOver4"],
				["image5", "", "imageOver5"]
			  ];
			
	// END CONFIG
	
	for (var x=0;x<arr.length;x++){
		
		var a = document.getElementsByTagName("a");
		for (var i=0;i<a.length;i++){
			var img = a[i].getElementsByTagName("img");		
			for (var j=0;j<img.length;j++){			
				if(img[j].className == arr[x][0] || arr[x][0] == ""){
					a[i].style.position = "static";						 
					if(a[i].getElementsByTagName("span").length > 0) a[i].removeChild(a[i].getElementsByTagName("span")[0]);
					var span = document.createElement("span");	
					var image = img[j];
					span.style.position = "absolute";
					span.style.top = image.offsetTop + "px";
					span.style.left = image.offsetLeft + "px";
					span.style.width = image.offsetWidth + "px";
					span.style.height = image.offsetHeight + "px";
					span.style.cursor = "pointer";
					span.out = span.className = arr[x][1];
					span.over = arr[x][2];
					span.a = img[j].a = a[i];	
					span.j = img[j].j = j;					
					a[i]["span" + j] = span;					
					span.onmouseover = img[j].onmouseover = function(){ 
						this.a["span" + this.j].className = this.a["span" + this.j].over;
					};
					span.onmouseout = img[j].onmouseout = function(){
						this.a["span" + this.j].className = this.a["span" + this.j].out;
					};
					a[i].appendChild(span);							
				};		
			};	
		};
		
	};
};



// script initiates on page load. 

this.addEvent = function(obj,type,fn){
	if(obj.attachEvent){
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn](window.event );}
		obj.attachEvent('on'+type, obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	};
};
addEvent(window,"load",imagelink);
addEvent(window,"resize",imagelink);

function show_photo(src, id) {
	var o = document.getElementById("photo");
	if (o) {
		o.src = src;
		if (o.t) {
			var x = document.getElementById(o.t);
			if (x) x.style.border = "none";
		}
		o.t = id;
		if (o.t) {
			var x = document.getElementById(o.t);
			if (x) x.style.border = "2px solid #807050";
		}
	}
}

