function showSubmitMessage(submitUrl, contentId){
	loadContent(submitUrl, contentId);
	//Animation(document.getElementById(contentId)).to('opacity',100).show().go();
	//alert(document.getElementById(contentId).innerHTML);
	return;	
}

function showQuestion(title,text){
	document.getElementById('title_question').innerHTML = title;
	document.getElementById('text_question').innerHTML = text;
	Animation(document.getElementById('question')).to('opacity',100).show().go();
	return;
}
function hideQuestion(){

	Animation(document.getElementById('question')).to('opacity',0).hide().go();		//Animation(document.getElementById('light')).to('height', '0px').to('width', '0px').to('opacity', 0).blind().hide().go();
	return;
}
	
function showAlert(title, text)
{
	
	document.getElementById('title_alert').innerHTML = title;
	document.getElementById('text_alert').innerHTML = text;
	
	Animation(document.getElementById('message')).to('opacity',100).show().go();
	//document.getElementById('light').style.display='block';
	//document.getElementById('fade').style.display='block';
	//document.body.style.overflowY = 'hidden';
	return;
}
function hideAlert(){
	Animation(document.getElementById('message')).to('opacity',0).hide().go();		//Animation(document.getElementById('light')).to('height', '0px').to('width', '0px').to('opacity', 0).blind().hide().go();
	//document.getElementById('light').style.display='none';
	//document.getElementById('fade').style.display='none';
	//document.body.style.overflowY = 'visible';		
	return;
}				
function newAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function loadContentPost(url, contentId, parameters){
	ajax=newAjax();	
	var content = document.getElementById(contentId);
	ajax.open('POST', url, true);

	ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajax.setRequestHeader("Content-length", parameters.length);
	ajax.setRequestHeader("Connection", "close");
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			content.innerHTML = ajax.responseText;
	 	}
	}
	ajax.send(parameters);

}
function execAjax(url){
	ajax=newAjax();	
	ajax.open("GET", url,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
	 	}
	}
	ajax.send(null)
}
function loadContent(url, contentId){
	ajax=newAjax();	
	var content = document.getElementById(contentId);
	ajax.open("GET", url,true);

	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			content.innerHTML = ajax.responseText;
	 	}
	}
	ajax.send(null)
}			
function lookup(inputString) {
    //alert(inputString);	
    if(inputString.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("RPC.php", {queryString: ""+inputString+""}, function(data){
            if(data.length >0) {
                $('#suggestions').show();
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup

function fill(thisValue) {
    $('#inputString').val(thisValue);
   $('#suggestions').hide();
}
function echeck(email) {
	var emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
  if(emailRegExp.test(email)){

	  return true;
  }else{

      return false;
  }
}
function getPostStr(formId){

	var postStr = '';
	
	var form = document.getElementById(formId);
	var elementsInputs = form.getElementsByTagName("input");
	for (var intCounter = 0; intCounter < elementsInputs.length; intCounter++){
		if('' != postStr){
			postStr = postStr + '&';
		}
		postStr = postStr + elementsInputs[intCounter].name + '=';
		postStr = postStr + encodeURI( elementsInputs[intCounter].value); 
	}
	var elementsTexts = form.getElementsByTagName("textarea");
	for (var intCounter = 0; intCounter < elementsTexts.length; intCounter++){
		if('' != postStr){
			postStr = postStr + '&';
		}
		
		postStr = postStr + elementsTexts[intCounter].name + '=';
		postStr = postStr + encodeURI( elementsTexts[intCounter].value); 
	}

	var elementsSelect = form.getElementsByTagName("select");
	
	for (var intCounter = 0; intCounter < elementsSelect.length; intCounter++){
		if('' != postStr){
			postStr = postStr + '&';
		}
		postStr = postStr + elementsSelect[intCounter].name + '=';
		
		for (var i=0;i<elementsSelect[intCounter].options.length;i++) {
			if(elementsSelect[intCounter].options[i].selected){
				postStr = postStr + encodeURI( elementsSelect[intCounter].options[i].value);			
			}
		}
	}
	return postStr;
	
}
