
function write_mail(m){
	s="@";
	document.write('<a href="mailto:'+m+s+'cadespa.ru">'+m+s+'cadespa.ru</a>');
}

function write_mail_com(m){
	s="@";
	document.write('<a href="mailto:'+m+s+'cadespa.com">'+m+s+'cadespa.com</a>');
}

opt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,";

	function openchild(page,width,height) {
// usage: onclick="return openchild(this.href[,width,height])"
 if (!(width)) {width=470} else {width+=25}
 if (!(height)){height=400}else {height+=45} 
 
 var img = /\.(jpg|jpeg|gif|png)$/;
 var scrollbars = (img.test(page) == false)? 'yes' : 'no';
 
 window.open(page,"_blank",opt+'scrollbars='+scrollbars+',width='+width+', height='+height);
 return false;
}

function smartClick (formname) {
// prepare "thin" window for the search results
document.forms[formname].target='wnd'+Math.round(Math.random()*10000);
window.open('',document.forms[formname].target,'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=640,height=480');
return true;
}


function fills (i) {
// fill extra spaces on large screens
   fill = new Array ('',1,1);
   extra =  document.body.clientWidth || window.innerWidth || 800;
   if ((extra -= 1004) > 0) {
      fill[1] = Math.round(extra/5); fill[2] = extra-fill[1];
   }
   for (i=1;i<3;i++) {img=document.getElementById('fill'+i);img.width=fill[i]}
   
}


function swapimg(imgname,imgsrc) {
// usage: onmouseover="swapimg('imgname','imgsrc')"
  document.images[imgname].src=imgsrc
}

function chobjscl (id,classname) {
// Change objecst style class
// usage: onclick="chobjscl('id','classname')"
   if (cellobj = document.getElementById(id)) {cellobj.className = classname} 
   // else {window.alert('Element "'+id+'" not defined...')}
} // chobjscl



function goTo(where) {
document.location.replace(where);
return false;
}

function gopageref(page) {
// usage: onclick="return gopageref('page')"
 var l = location.href;
 var iscgi = /\.cgi$/;
 var askpresent = /\.cgi\?/;
 page = (askpresent.test(page) == true)? page+'&r='+l : page+'?r='+l;
 window.open(page,"_self");
 return false;
}


function addBookmark(title,url) {
  if (window.sidebar) { 
    window.sidebar.addPanel(title,url,""); 
    // window.alert('Страничка "'+title+'" добавлена.');
    return false;
  } else if( document.all ) {
    window.external.AddFavorite(url, title);
    // window.alert('Страничка "'+title+'" добавлена.');
    return false;
  } else {
    return true;
  }
}

function setHomepage(page) {
// Устанавливает ссылку домашней страничкой. Если не может - возвращает true
// Использование: onclick="return setHomepage(url)"
  if ( document.all ) {
   this.style.behavior='url(#default#homepage)';
   this.setHomePage(page);
   return false;
  } else if(!document.layers) {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
   navigator.preference("browser.startup.homepage", page); 
   return false;
  }return true;
}

var defval = ' Ваш email...';

function _def_clear() {
// стирает "дефолтное" значение в поле email при нажатии кнопки, либо при получении фокуса.
  if (document.forms.form1.email.value == defval) {document.forms.form1.email.value=''}
}

function _check_address() {
// Проверяет, что значение в поле email является адресом электронной почты При случае стирает "дефолтное" значение, если оно еще осталось...
  obj = 'document.forms.form1.email.value'; _def_clear();
  if (_check_email(obj) == 1) {return false}
  if (eval(obj) == defval) {document.forms.form1.email.value='';return false} else {return true}  
}

function _check_email(addr) {
// проверка адреса электронной почты
  val = eval(addr); var mask = /^([\w-~_]+\.)*[\w-~_]+@([\w-_]+\.){1,3}\w{2,3}$/;
  if (mask.test(val) == false) {alert("Неправильный адрес электронной почты!");return 1} else {return 0}
}

opt = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=auto,width=100,height=100";
function openchild(page) {
 window.open(page,"_blank",opt);
 return false;
}

function open_window(url,w,h)
{
var left = parseInt( (document.body.clientWidth/2) - w/2 );
var window_name ="window"+Math.floor(Math.random()*100)+1;
window.open(url, window_name,"width="+w+",height="+h+",top=50%,left="+left+",resizable=no,location=no,scrollbars=1,status=no,toolbar=no,directories=no,menubar=no");

}

function preSubmit () { window.open("","queryform",'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=auto,width=500, height=450'); }

function Check_Ref(obj) {
 if ( isNaN(parseInt(obj.value)) || (obj.value<555) ){
	 alert("Ошибка, введите корректный Ref номер."); obj.select(); obj.focus();
	 return false;
 } else { return true; }
}

function mail_count()
{
d=document;var a='';a+=';r='+escape(d.referrer)
js=10
a+=';j='+navigator.javaEnabled()
js=11
s=screen;a+=';s='+s.width+'*'+s.height
a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth)
js=13
d.write('<IMG src="http://d1.c1.b0.a1.top.list.ru/counter'+
'?id=1053127;js='+js+a+';rand='+Math.random()+
'" height=1 width=1 />');
}


function trac() {
    t_params=""+Math.random()+"&l="+escape(window.location.href)+"&r="+escape(document.referrer);
    document.write("<img src='http://www.cadespa.ru/nocache/cupons.php?"+t_params+"'>");
}


function liveinternet () {


   document.write("<a href='http://www.liveinternet.ru/click' target=_blank><img src='//counter.yadro.ru/hit?t44.1;r" + escape(document.referrer) + ((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ";u" + escape(document.URL) +";h"+escape(document.title.substring(0,80)) +  ";" + Math.random() + "' border=0 width=31 height=31 alt='' title='LiveInternet'><\/a>")



}

