window.onload = function () {
setmyieSize();
        };
window.onresize = function () {
setmyieSize();
        };
$(document).ready(function(){
 $.fn.alignCenter = function() {
   var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
   var marginTop = Math.max(40, parseInt($(window).height()/2 - $(this).height()/2)) + 'px';
   return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
  };
$('.accordion2 div').eq(0).show();
$('.accordion3 div').eq(1).show();
$('.accordion3 div').eq(0).show();
$('.accordion1 div').eq(0).show();
$('.accordion1 div').eq(1).show();
for (i=0; i<5; i++){
$(".accordion"+i+" h4").click(function(){
  $(this).next("div").slideToggle("slow")
		//.siblings("div:visible").slideUp("slow");
		//$(this).toggleClass("act");
		//$(this).siblings("h4").removeClass("active");
	});
}
});


function showPopup(popup_type){
 $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7)
     .click(function(){closePopup();});
 $('#popup')
   .html($('#popup_' + popup_type).html())
   .alignCenter()
   .toggleClass('hidden');
  return false;
}

function closePopup()
{
  $('#opaco').toggleClass('hidden').removeAttr('style');
  $('#popup').toggleClass('hidden');
  return false;
}

function doThis(v){
s=document.createElement("SCRIPT");
document.body.appendChild(s);
s.src="/backend/log.php?tag="+v;
enForm();
}

function valM(n){
  var l = document.getElementById("mmm");
  var reg = /^[a-z][-a-z_.0-9]*@([-a-y_0-9]*\.)?[-a-z_0-9]*\.(ru|com|ua|by|info|biz|name|kz|tv|su|edu|org|net|cc|me)$/i;
  if (!reg.test(n)) l.innerHTML='Невалидный e-mail!';
  else l.innerHTML='';
  enForm();
}

function enForm(){
s=true;
var l = document.getElementById("mmm");
if(l.innerHTML != "") s=false;
l = document.getElementById("sda");
if (l.innerHTML != "Логин свободен.") s=false;
var l = document.getElementById("pass");
if (l.value.length < 3) s = false;
l = document.getElementById("rrr");
l.disabled=!s;
}

function $get(n){
 return (document.getElementById(n));
}
function set_myie(url){
    showPopup('my');
    c=$get('myie');
    c.src=url;
    
    return false;
}
function setmyieSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  $get('myie').width=myWidth-120;
  $get('myie').height=myHeight-120;
}







