function write_flash(filename, w, h, param, transparent) {
	document.write('<object align="middle" type="application/x-shockwave-flash" data="'+filename+'" Width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+filename+'" />');
	document.write('<param name="FlashVars" value="'+param+'" />');
	if (transparent) {
		document.write('<param name="wmode" value="transparent" />');
	}
	document.write('</object>');
}

function change_image(img_src, index) {
	
	//set_gallery(index, content_id);
	img_src_obj = document.getElementById('big_image_src');
	img_url_obj = document.getElementById('big_image_url');
	
	current_src = img_src_obj.src;
	current_url = img_url_obj.href;
	current_rel = img_url_obj.rel;
	
	src_to_replace = img_src;
	url_to_replace = img_src;
	rel_to_replace = (index) + 1;
	
	img_src_obj.src = img_src_obj.src.replace(current_src, src_to_replace);
	img_url_obj.href = img_url_obj.href.replace(current_url, url_to_replace);
	img_url_obj.rel = img_url_obj.rel.replace(current_rel, rel_to_replace);
	
}




function set_background_state(state, obj, ie_flag) {
	
	element = document.getElementById(obj);
	
	if (state == 'over') {
		if (ie_flag == 1) {
			element.style.backgroundImage = 'none';
			element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/"+obj+"_over.png',sizingMethod='scale');"
		} else {
			element.style.backgroundImage = 'url(images/'+obj+'_over.png)';
		}
	}
	
	if (state == 'out') {
		if (ie_flag == 1) {
			element.style.backgroundImage = 'none';
			element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/"+obj+".png',sizingMethod='scale');"
		} else {
			element.style.backgroundImage = 'url(images/'+obj+'.png)';
		}
	}
	
}

/* generic window opener */
function openwin(uri,title,w,h){
	if(w){wwidth = w;}else{	wwidth = 380;}
	if(h){wheight = h; }else{ wheight = 380;}
	xy = get_top_left(wwidth, wheight);
	wleft = xy[1];
	wtop = xy[0];
	wnd = window.open(uri, title, "width="+wwidth+", height="+wheight+", left="+wleft+", top="+wtop+", toolbar=no, location=no, scrollbars=yes, status=no, menubar=no, resizable=no, directories=no");
}


/* returns the x,y coordinates of the current screen (for multi monitor setup) */
function get_top_left(width, height){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	 		winL = window.screenX;
	 		winT = window.screenY;
	 	} else {
	  		winW = document.body.offsetWidth;
	  		winH = document.body.offsetHeight;
	  		winL = window.screenLeft;
	  		winT = window.screenTop;
	 	}
	}
	
	var scroll = 0;
	var l = winL + winW/2 - width/2;
	var t = winT + winH/2 - height/2;
	
	
  	if(screen.width <= width){
  		width=screen.width;
  	}
  	if(screen.height <= height){
  		height=screen.height;
 	 	var t = 0;
  		var scroll = 1;
  	}
	return Array(t,l);
}


function fix_tables() {
	
	var my_table = false;
	
	my_table = document.getElementsByTagName("table");
	
	if (my_table.length > 0) {
		for (i = 0; i < my_table.length; i++) {
			my_table[i].setAttribute("cellspacing", "0");
			my_table[i].setAttribute("cellpadding", "2");
			my_table[i].setAttribute("width", "100%");
			my_table[i].setAttribute("border", "0");
		}
	}
	
}
