function set_lang(lang_code){
    if ((document.location+'').indexOf('?')!=-1){
        document.location=document.location+'&lang='+lang_code;
    } else {
        document.location=document.location+'?lang='+lang_code;
    }
}

function show_video(videofile){
    var server_name = 'http://www.photonadel.com';
/*
    var newvideostring = '<object classid="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A" width="320" height="280" id="IFid1" class="ImageFrame_none">'+
      '<param name="ShowDisplay" value="0"/>'+
      '<param name="ShowControls" value="1"/>'+
      '<param name="AutoStart" value="1"/>'+
      '<PARAM NAME="AutoSize" VALUE="1">'+
      '<param name="AutoRewind" value="-1"/>'+
      '<PARAM NAME="ShowStatusBar" VALUE="1">'+
      '<param name="Volume" value="0"/>'+
      '<param name="FileName" value="'+server_name+videofile+'"/>'+
      '<embed src="'+server_name+videofile+'" width="320" height="350" type="video/x-ms-wmv"'+
      ' controller="true" autoplay="true" loop="false" SHOWSTATUSBAR="1" autosize="1" autostart="1" />'+
      '<noembed><a href="'+server_name+videofile+'">	      Download movie	    </a></noembed>'+
      '</object>';
*/
  var newvideostring = '<OBJECT ID="MediaPlayer" WIDTH="320" HEIGHT="280" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">'+
'<PARAM NAME="FileName" VALUE="'+server_name+videofile+'">'+
'<PARAM name="ShowControls" VALUE="true">'+
'<param name="ShowStatusBar" value="true">'+
'<PARAM name="ShowDisplay" VALUE="false">'+
'<PARAM name="autostart" VALUE="true">'+
'<EMBED TYPE="application/x-mplayer2" SRC="'+server_name+videofile+'" NAME="MediaPlayer" WIDTH="320" HEIGHT="280" ShowControls="1" ShowStatusBar="1" ShowDisplay="0" autostart="1"> </EMBED>'+
'</OBJECT>';

      OpenWindow=window.open("", "newwin", "height=305, width=340,toolbar=no,scrollbars=no,menubar=no");
      OpenWindow.document.write("<TITLE>Video Player</TITLE>");
      OpenWindow.document.write("<BODY>");
      OpenWindow.document.write(newvideostring);
      OpenWindow.document.write("</BODY>");
      OpenWindow.document.write("</HTML>");
}

function xmlreq_put(url,to_where) {
	var tw=document.getElementById(to_where);
	var ch=Math.round(tw.offsetHeight / 13);
	//alert();
	var extra='';
	for (t=0;t<ch;t++) {
		extra = extra + '<br>';
	}

	tw.innerHTML = '<img border=0 src=/images/loading.gif> <b style="color:f59231;">Loading...</b>'+extra;

	setTimeout(function(){

		var http_request = false;

		if (window.XMLHttpRequest) { // Mozilla, Safari, ...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/xml');
				// See note below about this line
			}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}

		if (!http_request) {
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}

		http_request.onreadystatechange = function() { applyContents(http_request,to_where); };
		http_request.open('GET', url, true);
		http_request.send(null);

	},50);

}

function applyContents(http_request,where) {

if (http_request.readyState == 4) {
	if (http_request.status == 200) {
	//alert(http_request.responseText);
	document.getElementById(where).innerHTML = http_request.responseText;
	} else {
	alert('There was a problem with the request.');
	}
}

}

function submit_contact_form() {
	var outString = '';

	var inputs = document.getElementById('contactform').getElementsByTagName('input');
	for (i=0;i<inputs.length;i++){
		if (inputs[i].value != '') {
			outString += '&frm[' +inputs[i].name + ']='+escape(inputs[i].value);
		}
	}
	if (outString=='') {
		alert ('Please input some info...');
	} else {
		outString += '&frm[message]='+escape(document.getElementById('message').value);
		xmlreq_put ('/?contact=1' + outString,'contactform');
	}
}

