/* preload SWF for IE7 */
function load_swf($ID, $filename, $width, $height){
	document.getElementById($ID).innerHTML = '<object type="application/x-shockwave-flash" data="' + $filename + '" width="' + $width + '" height="' + $height + '"><param name="menu" value="false" /><param name="movie"	value="' + $filename + '" /><param name="wmode" value="transparent" /></object>';
}
function show_object($object) {
	$object.style.visibility = "visible";
}
function hide_object($object) {
	$object.style.display = "none";
}

function equalize_thumbs() {
	var thumb_max_height=0;
	var div=document.getElementsByTagName('div');
	for(var z=0; z<div.length; z++) {
		if(div[z].className=='thumbnail_list equalize_thumbs') {
			var thumb=div[z].getElementsByTagName('a');
			var thumb_width = thumb[0].offsetWidth + 20;
			var thumb_inline = Math.floor((div[z].offsetWidth + 20)/thumb_width);
			var thumb_rows = Math.ceil(thumb.length/thumb_inline);
			for (i=0; i<thumb_rows; i++) {
				for (n=0; n<thumb_inline; n++) {
					var id = (i*thumb_inline)+n;
					var e = thumb[id];
					if (e) {
						if (thumb_max_height <= e.offsetHeight ) { 
							thumb_max_height = e.offsetHeight;
						}
					}
				}
				for (n=0; n<thumb_inline; n++) {
					var id = (i*thumb_inline)+n;
					var e = thumb[id];
					if (e) {
						e.style.height = thumb_max_height+"px";
					}
				}
				thumb_max_height = 0;
			}
		}
	}
}

function writeFlash(filename, width, height){
	var background		=(arguments[3])?arguments[3]:'#FFFFFF';
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'"  align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+filename+'" /><param name="quality" value="high" /><param name="bgcolor" value="'+background+'" /><embed src="'+filename+'" quality="high" bgcolor="'+background+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function refresh_kcaptcha(url,obj) {
	if(url.href){
		document.getElementById(obj).src=url.href+ '&' + Math.random();
	}
	return false;
}
