/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var subChange = function(a){ //alert(a); alert($F('openMenu'));
    if($F('openMenu')!= "closed" && $F('openMenu') != a){ 
        //$($F('openMenu')).fade({duration:0.5});
		Element.hide($F('openMenu'));
    }
    $('openMenu').value = a;
    Element.show(a); //$(a).appear({duration:0.5});
}

var subClose = function() {
    if($F('openMenu') != 'closed'){
        //$($F('openMenu')).fade({duration:0.5});
		Element.hide($F('openMenu'));
        $('openMenu').value = 'closed';
    }
}
var switchFake = function(){
        Element.hide($('inFake'));
        Element.show($('inPass'));
        $('inPass').focus();

}
var switchLogin = function(){
	Element.hide($('inPass'));
	Element.show($('inFake'));
}
var deleteGPS = function(p,q){
    var query = new Ajax.Request
		("xml/upd.inc.php",{
                    parameters:{
                    method:"post",
                    type:'deleteGPS',
                    map:p,
                    usr:q
                    },
                    onSuccess:location.href="gps-touren.php"
		});
}

var sndMsg = function(){
	var query = new Ajax.Request
	("xml/sndMsg.inc.php",{
		parameters:{
		method:"post",
		inMail:$F('inMail'),
		inName:$F('inName'),
		
		inMsg:$F('inMsg')
		},
		onSuccess:resultMsg
	});
}

var resultMsg = function(getXML){
	xml = getXML.responseText; alert(xml);
	xml = xml.split("@|@");
	if(xml[0] == "error"){
		Element.show('errorCompany');
		$('errorCompany').innerHTML = xml[1];
	} else {
		Element.hide('errorCompany');
		Element.hide('contact');
		Element.show('success');
	}
}
