nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

/* object - image to be faded (actual object, not name);
 * destop - destination transparency level (ie 80, for mostly solid)
 * rate   - time in milliseconds between trasparency changes (best under 100)
 * delta  - amount of change each time (ie 5, for 5% change in transparency)
 */

function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

////////////// КОРЗИНА ///////////////
function in_basket(id) {
	if (document.getElementById('ad'+id).checked==true) 
	{
		addCookieForever('ad'+id, '1');
	} 
	else 
	{
	delCookie('ad'+id);
	}
};
function delete_from_basket(id) {
	delCookie('ad'+id);
	window.location.reload();
};
////////////// КОРЗИНА ///////////////

// просмотр оргинального фото
function photo_look(theURL,winName,x,y) {
  if (x<800 && y<800) features="width="+x+", height="+y; else features='';
  window.open(theURL,winName,features);
};

function validate_email()
{
if (document.getElementById('r_email').value!='') {
var reg= new RegExp("^[0-9a-z_^\.]+@[0-9a-z_^\.]+\.[a-z]{2,6}$", 'i')
if (!reg.test(document.getElementById('r_email').value)) 
	{
	document.getElementById('r_email').style.borderColor="red";
	alert('Неправильный e-mail!');
	} else {
	document.getElementById('r_email').style.borderColor="#00FB00";
	}
}
}
// ширина окна броузера
function screen_width()
{
var width=0;
if (self.screen) {     // for NN4 and IE4
	width = screen.width
}
else if (self.java) {   // for NN3 with enabled Java
	var jkit = java.awt.Toolkit.getDefaultToolkit();
	var scrsize = jkit.getScreenSize();       
	width = scrsize.width; 
}
return width;
}
// открытие нового окна
var v=parseInt(navigator.appVersion);
isNetscape=navigator.appName.indexOf('Netscape')>=0;
isExplorer=navigator.appName.indexOf('Explorer')>=0;
if(v>=3) self.focus();

function popupWindow(ww, wh, page) {
//ww=800;  wh=600;
positionCode='';
if(v>=4) {
   sw  = screen.width;
   sh  = screen.height;
   wbx = Math.round((sw-ww)/2);
   wby = Math.round((sh-wh)/2);
   if(isExplorer) positionCode='left='+wbx+',top='+wby+',';
   if(isNetscape) positionCode='screenX='+wbx+',screenY='+wby+',';
}

newWindow = window.open(page,'','width='+ww+',height='+wh+','+positionCode+'toolbar=0,'+'scrollbars=1,'+'resizable=0');
if(isNetscape && v>=3) newWindow.focus();
}

function hide_form_search()
{
document.getElementById('search_form').style.display="none";
document.getElementById('show_search_form').style.display="";
document.getElementById('hide_search_form').style.display="none";
}

function show_form_search()
{
document.getElementById('search_form').style.display="";
document.getElementById('show_search_form').style.display="none";
document.getElementById('save_url').style.display="none";
document.getElementById('hide_search_form').style.display="";
}
function GoToEmail(server,mail)
{
	var simbol = "@"; 
	var email = mail + simbol + server;
	window.location = "mailto:" + email;
}
