<!--
function open_window(width,height,url,name){
	height-=20;
	features="width="+width+",height="+height;
	window.open(url,name,features);
}
function add_smiley(icon){
	document.forms["comment"].comments.value=document.forms["comment"].comments.value+icon;
}

// AJAX
// initialize xmlhttp object & ajax_target
	var ajax_target;
	var xmlhttp = null;
	function initialize_ajax(){
		try {
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) {
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		
		// when ready
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4)
				try {
					if (xmlhttp.status == 200) {
						document.getElementById(ajax_target).innerHTML = xmlhttp.responseText;
					}
				} catch (e) {
					alert("Error on Ajax return call : " + e.description);
				}
		}
	}

// the ajax call
	function loadXMLDoc(url,method,target_id,values){
		initialize_ajax();
		ajax_target=target_id;
		if(method == "GET")
			url = addValues(url,values);
		xmlhttp.open(method,url,true);
		if(method == "POST")
			xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.send(values);
	}
	
// adding GET variables in the URL
	function addValues(url, values){
		if(url.indexOf("?") != -1)
			url = url+'&'+values;
		else
			url = url+'?'+values;
		return url;
	}
function switch_content(url,method,values){
		if ( method === undefined ) {
			method = 'GET';
		}
		if ( values === undefined ) {
			values = '';
		}
		document.getElementById('load-status').innerHTML='loading <img align="top" src="layout/ajax-loader-switch.gif" width="220" height="19" alt="loading">';
		loadXMLDoc(url,method,'content',values);
}
function login(){
	if(!(document.getElementById('login-username').value && document.getElementById('login-password').value))
		alert('Please complete all the fields.');
	else{
		values='login-username='+document.getElementById('login-username').value+'&login-password='+document.getElementById('login-password').value+'&login-submit='+document.getElementById('login-submit').value;
		document.getElementById('auth').innerHTML='<img align="top" src="layout/ajax-loader.gif" width="16" height="16" alt="login"> Login in progress...';
		loadXMLDoc('ajax/ajax_auth.php?action=login','POST','auth',values);
	}
}

function add_comment(image_id){
	if(!document.getElementById('input-comments').value)
		alert('Please type in your comments.');
	else{
		values='pic='+image_id+'&input-comments='+escape(document.getElementById('input-comments').value);
		loadXMLDoc('ajax/ajax_comments.php?action=add','POST','comments',values);
	}
}

function form_emailtoafriend(picture_id){
	if(!(document.getElementById('sender_name').value && document.getElementById('sender_email').value && document.getElementById('receiver_name').value && document.getElementById('receiver_email').value))
		alert('Please complete all the fields.');
	else{
		values='sender_name='+document.getElementById('sender_name').value+'&sender_email='+document.getElementById('sender_email').value+'&receiver_name='+document.getElementById('receiver_name').value+'&receiver_email='+document.getElementById('receiver_email').value+'&Submit='+document.getElementById('Submit').value;
		loadXMLDoc('ajax/ajax_emailtoafriend.php?id='+picture_id,'POST','email-to-a-friend',values);
	}
} //-->