﻿// JScript File

	var qDiv = 12;
    var curDiv = 1;
    var curDiv1 = 1;
    var oldDiv = 1;
    var opacityStep = 1;
    var idTimer;
    var transparent=true;
	var pauseTimer;

	var videoDiv = "vid1";
	var videoDivR = "vidr1";
    var videoDiv1 = "vid11";
	var nLink = "link1";
		
	function StartAgain()
	{
		//clearTimeout(pauseTimer);
		transparent = true;
	}
	
	
	function ShowArticle(n)
	{
		transparent = false;
		ShowPicture(n);
		
	}
	
	function ShowPicture(nShow)
	{
//		
  
		
		curDiv = nShow;

		//text = document.getElementById("title"+oldDiv);
		//text.style.color="#A2A6A7";
		//text = document.getElementById("title"+curDiv);
		//text.style.color="#DD3A03";
		
		text = document.getElementById("td_id"+oldDiv);
		text.style.backgroundColor='transparent';
		
		text = document.getElementById("td_id"+curDiv);
		text.style.backgroundColor='#f2f1e6';
	    text.style.color='#000';
	    	    
		var div_id = qDiv-nShow +1;
		div_id="pos"+div_id;
		for(i=1; i<=qDiv; i++)
		{
			var curdiv_id = "pos"+i;
			div = document.getElementById(curdiv_id);
			if(i==nShow)
			{
				$(div).css({zIndex:qDiv+1})
				//div.style.zIndex=qDiv+1;
			}else{
			    $(div).css({zIndex:1})
				//div.style.zIndex=1;
			}
		}
		oldDiv = curDiv;
	}
	
	function ShowVid(div)
	{
	
	     var curDiv = document.getElementById(videoDiv); 
	    curDiv.style.zIndex=1;
	    curDiv.style.visibility="hidden";
	    //curDiv.transparent="true";

	    curDiv = document.getElementById("txt"+videoDiv); 
	    curDiv.style.zIndex=1;
	    curDiv.style.visibility="hidden";
	    
	    var ddiv = document.getElementById(div);
	    ddiv.style.zIndex=100;
	    ddiv.style.visibility="visible";
	    //ddiv.transparent="false";
	    
	    ddiv = document.getElementById("txt"+div);
	    ddiv.style.zIndex=100;
	    ddiv.style.visibility="visible";
	    
	    
	    videoDiv=div

	}

	function ShowVidR(div) {

	    var curDiv = document.getElementById(videoDivR);
	    curDiv.style.zIndex = 1;
	    curDiv.style.visibility = "hidden";
	    //curDiv.transparent="true";

	    curDiv = document.getElementById("txt" + videoDivR);
	    curDiv.style.zIndex = 1;
	    curDiv.style.visibility = "hidden";

	    var ddiv = document.getElementById(div);
	    ddiv.style.zIndex = 100;
	    ddiv.style.visibility = "visible";
	    //ddiv.transparent="false";

	    ddiv = document.getElementById("txt" + div);
	    ddiv.style.zIndex = 100;
	    ddiv.style.visibility = "visible";


	    videoDivR = div

	}
	
	function ShowVid2(div1)
	{
	
	    curDiv = document.getElementById(videoDiv1); 
	    curDiv.style.zIndex=1;
	    //curDiv.transparent="true";
        curDiv.style.visibility="hidden";
            
	    curDiv = document.getElementById("txt"+videoDiv1); 
	    curDiv.style.zIndex=1;
	    curDiv.style.visibility="hidden";
	    
	    ddiv = document.getElementById(div1);
	    ddiv.style.zIndex=100;
	    ddiv.style.visibility="visible";
	    //ddiv.transparent="false";
	    
	    ddiv = document.getElementById("txt"+div1);
	    ddiv.style.zIndex=100;
	    ddiv.style.visibility="visible";
	    
	 
	  	videoDiv1=div1
	    
	}
	
    function ShowLink(link)
	{  
	
	    curDiv = document.getElementById(nLink);
	    curDiv.style.backgroundColor="#D0C6AA";
	    curDiv.style.color="#000";
	    //curDiv.style.background=" url(/img/but_gr.gif) no-repeat 0px 0px";

	    
	    ddiv = document.getElementById(link);
	    ddiv.style.backgroundColor="#ed831d";
	    ddiv.style.color="#fff";
	   //ddiv.style.background=" url(/img/but_grdark.gif) no-repeat 0px 0px";
	  
	  
	  	nLink=link
	}
	
	function Group_box(dv,lnk)
	{
	  ShowVid2(dv);
	  ShowLink(lnk);
	   
	}
	
	function ReplacePositions()
	{
	//	clearTimeout(idTimer);
		
		
		if(transparent)
		{
			curDiv = (curDiv % qDiv)+1;
			ShowPicture(curDiv);
			//window.status="true " + idTimer;
		}else
		{
			//window.status="false " + idTimer;
		}
		//idTimer = window.setTimeout("ReplacePositions()", 3000);
	}
	
	function TableLeave()
	{
		transparent = true;
	}
	
	function doOnLoad()
	{
		//idTimer = window.setTimeout("ReplacePositions()", 3000);

	}

	function doOnUnload()
	{
	//	clearTimeout(idTimer);
	}

function onEnterpress(e)
{

    var KeyPress  
    //if which property of event object is supported  
    if(e && e.which)
    {
        e = e
        //character code is contained in NN4's which property
        KeyPress = e.which 
    }else{
        e = event
        KeyPress = e.keyCode
    }
    //13 is the key code of enter key
    if(KeyPress == 13)
    {
    
		var hid=document.getElementById("Head_ctrl1_m_imbSearch");
		var title = document.getElementById("search_recipe");
		if(hid != null)
			hid.disabled=true;
    
		hid=document.getElementById("m_hidSearch");
		if(hid != null && document.getElementById("search_recipe") != null)
		{
				hid.value=document.getElementById("search_recipe").value;
			if(document.getElementById("m_btn_titleSearch") != null)
				document.getElementById("m_btn_titleSearch").click();
			else
				window.location="rcp_search.aspx?simple=1&title="+hid.value;
		}
        return false;
    }
    else
       return true;
}

function setHP(obj) {
if (document.all) {
  obj.style.behavior='url(#default#homepage)';
  obj.setHomePage('http://www.gastronom.ru');
  return false;
} else if(!document.layers) {
  netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
  navigator.preference("browser.startup.homepage", "http://www.gastronom.ru");
 return false;
}
return true;
}

