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 openFlash(_width, _height, _img, _title, _id) {
  obj_id = document.getElementById(_id);
  _height = 280 + 6;
  _width = 438 + 6;
  n_height = _height + 24;
  n_width = _width + 4;  
  
  
  var $leftcoord = $("#mainbody").innerWidth();
  $leftcoord = (parseInt($leftcoord)/2)-220;
  
  //placePopupDiv('openflash-ramka', 20, 20, 1);
  
  panorama = window.open("/panorama.php?name="+_img+"&pntype=0", "panorama", "location=1,status=1,scrollbars=1,width=458,height=300");
  panorama.moveTo($leftcoord,280);

  
  //$("#openflash-ramka").css("top", "240px").css("left", $leftcoord+"px").css("width", n_width+"px").css("height", n_height+"px").show();
  
 
  $("#openflash-ramka-in-body").css("width", _width+"px").css("height", _height+"px").html("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='438' height='280' id='panorama'><param name='movie' value='/swf/panorama.swf?name="+_img+"&pntype=0'><param name='menu' value='false'><param name='quality' value='high'><param name='bgcolor' value='#eaeef3'><embed src='/swf/panorama.swf?name="+_img+"&pntype=0' menu='false' quality='high' bgcolor='#eaeef3' width='438' height='280' name='panorama' type='application/x-shockwave-flash' pluginpage='http://www.macromedia.com/go/getflashplayer'></embed></object>");
  
//Прячем flash
  $("#openflash-ramka-in-body").css("cursor", "pointer").click(function(){
    $("#openflash-ramka").hide();
  })
  
  $("#openflash-ramka-in-title span").css("cursor", "pointer").css("color", "#fff").click(function(){
    $("#openflash-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 = ''; 
    
  }
}