function aj_req(container)
{
	alert(container);
}

function send_email()
{
	if(!checkEmail())
	{
		return;		
	}
	
	ajax.post('/save_email/', aj_req , 'email='+document.subFrom.email.value);
}

function checkEmail() {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.subFrom.email.value)){
	return true;
	}
	alert("Неверный E-mail!");
	return false;
}


function popimg(url, title, width, height)

{

	str="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"><html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">\n<title>Denon</title>\n</head>\n<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n<img src='"+url+"' alt='"+title+"'>\n</body>\n</html>";

	f_win = window.open(url ,"BigImage" ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=no,resizable=yes,menubar=no,status=no,directories=no,location=no');

	f_win.document.writeln(str);

	f_win.focus();

	f_win.document.close();

}



function popup(url, title, width, height)

{

	f_win = window.open(url ,"" ,'width='+width+',height='+height+',top='+((screen.height/2)-(height/2))+',left='+((screen.width/2)-(width/2))+',toolbar=no,scrollbars=yes,resizable=yes,menubar=no,status=no,directories=no,location=no');

	f_win.focus();

}



function show_ps(id)

{

  var i=0;

  if(document.getElementById(id).style.display == 'none')

  {

    document.getElementById(id).style.display = 'block';

    for(i=1; i<=4; i++)

    {

      if(('p'+i) != id)

        document.getElementById('p'+i).style.display = 'none';

    }

  }

}



function show_content(id) //Каталог -> Описание 

{

  var q;

  if(document.getElementById(id).style.display == 'none')

  {

    document.getElementById(id).style.display = 'block';

    for(q=1;;q++)

    {

      if('layer'+q != id)

	  	var elem=document.getElementById('layer'+q);

		

		if(elem == null)

			break;

		

		elem.style.display = 'none';

    }

  }

  else

  {

    document.getElementById(id).style.display = 'none';

  }

}





function IM_swapImgRestore() { //v3.0

  var i,x,a=document.IM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function IM_preloadImages() 

{ //v3.0

  var d=document; 

  if(d.images)

  { 

	if(!d.IM_p) 

	  d.IM_p=new Array();

    var i,j=d.IM_p.length,a=IM_preloadImages.arguments; 

    for(i=0; i<a.length; i++)

    {

      if (a[i].indexOf("#")!=0)

      { 

        d.IM_p[j]=new Image; 

        d.IM_p[j++].src=a[i];

      }

    }

  }

}



function IM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=IM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function IM_swapImage() { //v3.0

  var i,j=0,x,a=IM_swapImage.arguments; document.IM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=IM_findObj(a[i]))!=null){document.IM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



//--------------from_nick--------------------





var w3c = (document.getElementById) ?true:false;

var iex = (document.all)            ?true:false;

var ns4 = (document.layers)         ?true:false;

var supported = (w3c || iex || ns4) ?true:false;



var active = false;

var curObj,curNest;



function mousemoved (evt){

	if(iex){

		mousex = window.event.clientX+document.body.scrollLeft;

		mousey = window.event.clientY+document.body.scrollTop;

	}

	else if(ns4){

		mousex = evt.pageX+window.pageXOffset;

		mousey = evt.pageY+window.pageYOffset;

	}

	else{

		mousex = evt.pageX;

		mousey = evt.pageY;

	}

	if(active){

		shiftTo(curObj, mousex+20, mousey-20, curNest);

	}

	return true;

}



// =-=-=-=-=-=-=



function getStyle (objstr, nest){

	nest = (nest) ? "document."+nest+"." : "";

	return (w3c) ? document.getElementById(objstr).style : (iex) ? document.all[objstr].style : (ns4) ? eval(nest+"document."+objstr) : false;

}

function shiftTo (objstr, x, y, nest){

	var obj = getStyle(objstr,nest);

	if(iex){

		obj.pixelLeft = x;

		obj.pixelTop = y-5;

	}

	else if(ns4){

		obj.moveTo(x,y);

	}

	else if(w3c){

		obj.left = x;

		obj.top = y-5;

	}

}

function show (objstr,nest){

	curObj = objstr;

	curNest = (nest) ? nest : null;

	getStyle(objstr,nest).visibility = "visible";

	active = true;

}

function hide (){

	getStyle(curObj,curNest).visibility = "hidden";

	active = false;

}



// =-=-=-=-=-=-=



if(supported){

	if(ns4){

		document.captureEvents(Event.MOUSEMOVE);

	}

	document.onmousemove = mousemoved;

}



// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



// Menu

var mid='';

var flag;

/*Array.prototype.inArray = function (value) {

	var i;

	for (i=0; i < this.length; i++) {

		if (this[i] === value) {

			return true;

		}

	}

	return false;

};*/

/*var a = [];

var b = ["u2", "u77", "u78", "u79"];*/

/*

a["u2"] = null;

a["u77"] = null;

a["u78"] = "u77";

a["u79"] = "u78";

*/

var col = 0;



function on(it, level) {

		//alert(level);

	col--;

	if(col == 0) return;

	var f = it.getElementsByTagName("ul")[0].id;

	for(var i = 0 ; i < b.length; i++)

	{

		if(document.getElementById(b[i])!=null)

			document.getElementById(b[i]).style.display='none';

	}

	

	while(f != 'unull')	

	{

		col++;

		document.getElementById(f).style.display='block';

		f = a[f];

	}


}

function flash() {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
			'width', '475',
			'height', '376',
			'src', 'flash',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'flash',
			'name', 'flash',
			'menu', 'false',
			'allowScriptAccess','sameDomain',
			'allowFullScreen','false',
			'movie', 'flash',
			'salign', ''
			);
	} else {
		var alternateContent = '<a href=http://www.macromedia.com/go/getflash/>Flash Movie</a>';
		document.write(alternateContent);
	}
}


