function swaplogos() {
if ($("#ourlogo1").is(":hidden")) {
$("#ourselectionlogo2").fadeOut(2000);
$("#ourselectionlogo").fadeIn(2000);

$("#ourlogo2").fadeOut(2000);
$("#ourlogo1").fadeIn(2000);

}

else
{
$("#ourlogo1").fadeOut(2000);
$("#ourlogo2").fadeIn(2000);

$("#ourselectionlogo").fadeOut(2000);
$("#ourselectionlogo2").fadeIn(2000);

}

function fix_flash() {
    // loop through every embed tag on the site
    var embeds = document.getElementsByTagName('embed');
    for(i=0; i<embeds.length; i++)  {
        embed = embeds[i];
        var new_embed;
        // everything but Firefox & Konqueror
        if(embed.outerHTML) {
            var html = embed.outerHTML;
            // replace an existing wmode parameter
            if(html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
                new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i,"wmode='transparent'");
            // add a new wmode parameter
            else 
                new_embed = html.replace(/<embed\s/i,"<embed wmode='transparent' ");
            // replace the old embed object with the fixed version
            embed.insertAdjacentHTML('beforeBegin',new_embed);
            embed.parentNode.removeChild(embed);
        } else {
            // cloneNode is buggy in some versions of Safari & Opera, but works fine in FF
            new_embed = embed.cloneNode(true);
            if(!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase()=='window')
                new_embed.setAttribute('wmode','transparent');
            embed.parentNode.replaceChild(new_embed,embed);
        }
    }
    // loop through every object tag on the site
    var objects = document.getElementsByTagName('object');
    for(i=0; i<objects.length; i++) {
        object = objects[i];
        var new_object;
        // object is an IE specific tag so we can use outerHTML here
        if(object.outerHTML) {
            var html = object.outerHTML;
            // replace an existing wmode parameter
            if(html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
                new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i,"<param name='wmode' value='transparent' />");
            // add a new wmode parameter
            else 
                new_object = html.replace(/<\/object\>/i,"<param name='wmode' value='transparent' />\n</object>");
            // loop through each of the param tags
            var children = object.childNodes;
            for(j=0; j<children.length; j++) {
                if(children[j].getAttribute('name').match(/flashvars/i)) {
                    new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i,"<param name='flashvars' value='"+children[j].getAttribute('value')+"' />");
                }
            }
            // replace the old embed object with the fixed versiony
            object.insertAdjacentHTML('beforeBegin',new_object);
            object.parentNode.removeChild(object);
        }
    }
}


/*
if ($("#ourselectionlogo").is(":hidden")) {

$("#ourselectionlogo2").fadeOut(2000);
$("#ourselectionlogo").fadeIn(2000);

}

else
{
$("#ourselectionlogo").fadeOut(2000);
$("#ourselectionlogo2").fadeIn(2000);

}

*/

setTimeout ( "swaplogos()", 6000 );

}

function checkcapcha(){
var val1 =  document.getElementById('mycaptcha').value;
if(!isFloat(val1)){alert("Только цифры");document.getElementById('mycaptcha').value=""; return;}
}

function isFloat(value){
if(value==0){return true;}
   if(isNaN(value) ){
     return false;
   } else {
      if(parseFloat(value)) {
              return true;
          } else {
              return false;
          }
   }
}

function sendmyform() {
checkcapcha();

if(document.getElementById('myname').value==""){alert("Введите ваше имя");return;}
if(document.getElementById('myemail').value==""){alert("Введите ваш email");return;}
if(document.getElementById('mysubject').value==""){alert("Введите тему вашего сообщения");return;}
if(document.getElementById('mycomments').value==""){alert("Введите ваше сообщение");return;}
if(document.getElementById('mycaptcha').value==""){alert("Введите проверочный код");return;}


var http = new XMLHttpRequest();
var url = "assets/snippets/eml.php";
var params = "formout=";

for(i=0;i<document.forms["mydata"].elements.length;i++){
params += document.forms["mydata"].elements[i].value; params+= "^";

}
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		alert(http.responseText);
		var str = http.responseText;
		if(str=="Спасибо! Ваши данные отправлены"){window.location.href = "index.html";}
		
	}
}
http.send(params);

}

function sendzayvka() {
checkcapcha();

if(document.getElementById('myname2').value==""){alert("Введите ваше Ф. И. О.");return;}
if(document.getElementById('mypost2').value==""){alert("Введите вашу должность");return;}
if(document.getElementById('myemail2').value==""){alert("Введите ваш email");return;}
if(document.getElementById('mymess2').value==""){alert("Введите ваше сообщение");return;}
if(document.getElementById('mycaptcha').value==""){alert("Введите проверочный код");return;}


var http = new XMLHttpRequest();
var url = "http://www.algris.ru/assets/snippets/zayvka.php";
var params = "formout2=";

for(i=0;i<document.forms["mydata2"].elements.length;i++){
params += document.forms["mydata2"].elements[i].value; params+= "^";

}
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		alert(http.responseText);
		var str = http.responseText;
		if(str=="Спасибо! Ваши данные отправлены"){window.location.href = "index.html";}
		
	}
}
http.send(params);

}

function sendformcont() {
checkcapcha();

if(document.getElementById('myorg3').value==""){alert("Введите название организации");return;}
if(document.getElementById('myphone3').value==""){alert("Введите контактный телефон");return;}
if(document.getElementById('myname3').value==""){alert("Введите контактное лицо");return;}
if(document.getElementById('myemail3').value==""){alert("Введите ваш email");return;}
if(document.getElementById('mymess3').value==""){alert("Введите ваше сообщение");return;}
if(document.getElementById('mycaptcha').value==""){alert("Введите проверочный код");return;}


var http = new XMLHttpRequest();
var url = "http://www.algris.ru/assets/snippets/formcont.php";
var params = "formout3=";

for(i=0;i<document.forms["formcont"].elements.length;i++){
params += document.forms["formcont"].elements[i].value; params+= "^";

}

http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		alert(http.responseText);
		var str = http.responseText;
		if(str=="Спасибо! Ваши данные отправлены"){window.location.href = "index.html";}
		
	}
}
http.send(params);

}

