function SendEMail( domain, mailbox ){
  var sLink = 'mailto:' ;
	sLink += mailbox ;
	sLink += '@' ;
	sLink += domain ;
	window.location = sLink ;	
	return false ;
}


  function findOffsetPos(obj) {
    //Находим координаты объекта относительно самого верха
  	var curleft = curtop = 0;
  	if (obj.offsetParent) {
  		do {
  			curleft += obj.offsetLeft;
  			curtop += obj.offsetTop;
  		} while (obj = obj.offsetParent);
  	}
  	return [curleft,curtop];
  }
  
  //Аналог $_GET  
  function js_get(key_str) {
  	if(window.location.search) {
  		var query = window.location.search.substr(1);
  		var pairs = query.split("&");
  		for(var i = 0; i < pairs.length; i++) {
  			var pair = pairs[i].split("=");
  			if(unescape(pair[0]) == key_str)
  				return unescape(pair[1]);
  		}
  	}
  }

  function placePopupDiv(obj, _offsetLeft, _offsetTop, _scroll){
    objName = obj;
  	obj = document.getElementById(obj);
  	if (document.documentElement)	{
  		theLeft = document.documentElement.scrollLeft;
  		theTop = document.documentElement.scrollTop;
  	}	else if (document.body)	{
  		theLeft = document.body.scrollLeft;
  		theTop = document.body.scrollTop;
  	}
  
  	theLeft += _offsetLeft;
  	theTop += _offsetTop;
  	obj.style.left = theLeft + 'px' ;
  	obj.style.top = theTop + 'px' ;
  	if (_scroll == 1){
  	 //setTimeout("placePopupDiv('"+objName+"', "+_offsetLeft+", "+_offsetTop+", 1)",100);
  	}
  }  

function openWin(_width, _height, _img, _title,_id) {
  obj_id = document.getElementById(_id)
  placePopupDiv('openwin-ramka', 0, 0, 0);
  
  _height = _height + 6;
  _width = _width + 6;
  n_height = _height + 24;
  n_width = _width + 4;
  $("#openwin-ramka").css("width", n_width+"px").css("height", n_height+"px").slideToggle(200);
  //$("#openwin-ramka-in-body").css("width", _width+"px").css("height", _height+"px").css("background", "url("+_img+")").css("background-repeat", "no-repeat").css("background-position", "center");
  
  
$("#openwin-ramka-in-body").css("width", _width+"px").css("height", _height+"px").html("<img src="+_img+" id='megaphotoforload'>");

if (!jQuery.browser.opera){
  $("#megaphotoforload").css("display", "none");
  $("#megaphotoforload").load(function(){
    $("#megaphotoforload").show();
  });
}
  
//Прячем картинку
  $("#openwin-ramka-in-body").css("cursor", "pointer").click(function(){
    $("#megaphotoforload").hide();
    $("#openwin-ramka").hide();
  })
  
  $("#openwin-ramka-in-title span").css("cursor", "pointer").css("color", "#fff").click(function(){
    $("#megaphotoforload").hide();    
    $("#openwin-ramka").hide();
  })
}


function changeBannerType(){
  //Если баннер
  if (document.banner.type.value=='banner'){
    if(document.getElementById('target')) document.getElementById('target').style.display = '';
    if(document.getElementById('img')) document.getElementById('img').style.display = '';
    if(document.getElementById('link')) document.getElementById('link').style.display = '';
    if(document.getElementById('width')) document.getElementById('width').style.display = '';
    if(document.getElementById('height')) document.getElementById('height').style.display = '';
    if(document.getElementById('code')) document.getElementById('code').style.display = 'none';    
      }
  //Если флэша
  if (document.banner.type.value=='flash'){
    if(document.getElementById('target')) document.getElementById('target').style.display = 'none';
    if(document.getElementById('img')) document.getElementById('img').style.display = '';
    if(document.getElementById('link')) document.getElementById('link').style.display = 'none';
    if(document.getElementById('width')) document.getElementById('width').style.display = '';
    if(document.getElementById('height')) document.getElementById('height').style.display = '';
    if(document.getElementById('code')) document.getElementById('code').style.display = 'none'; 
    
  }
  //Если код
  if (document.banner.type.value=='code'){
    if(document.getElementById('target')) document.getElementById('target').style.display = 'none';
    if(document.getElementById('img')) document.getElementById('img').style.display = 'none';
    if(document.getElementById('link')) document.getElementById('link').style.display = 'none';
    if(document.getElementById('width')) document.getElementById('width').style.display = 'none';
    if(document.getElementById('height')) document.getElementById('height').style.display = 'none';
    if(document.getElementById('code')) document.getElementById('code').style.display = ''; 
    
  }
}
