

function OrderFormSubmit(url) // Заказать звонок
{
	alert('url='+url);

	var parameters='user_lname='+encodeURI(document.getElementById("user_lname").value)+'&user_name='+encodeURI(document.getElementById("user_name").value);

	alert('url='+url+' param='+parameters);


 	http_request = false;

      	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType)
		{
                	// set type accordingly to anticipated content type
               		http_request.overrideMimeType('text/html');
            	}
        }
	else if (window.ActiveXObject)
	{ // IE
         try
		{
            		http_request = new ActiveXObject("Msxml2.XMLHTTP");
         	}
		catch (e)
		{
            		try
			{
               			http_request = new ActiveXObject("Microsoft.XMLHTTP");
            		}
			catch (e) {}
         	}
        }

      if (!http_request)
	{
         alert('Cannot create XMLHTTP instance');
         return false;
      }

      http_request.onreadystatechange = GetFormOrderData;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);

}

function CallOrderSubmit(url) // Заказать звонок
{
	//alert('url='+url+'  params='+parameters);

	if (document.getElementById('call_order_capture_input')!=null)
	   var parameters='user_name='+encodeURI(document.getElementById("user_name").value)+'&user_phone='+encodeURI(document.getElementById("user_phone").value)+'&calltime='+encodeURI(document.getElementById("calltime").value)+'&edditinal='+encodeURI(document.getElementById("edditinal").value)+'&capture_input='+encodeURI(document.getElementById("call_order_capture_input").value);
	else
	   var parameters='user_name='+encodeURI(document.getElementById("user_name").value)+'&user_phone='+encodeURI(document.getElementById("user_phone").value)+'&calltime='+encodeURI(document.getElementById("calltime").value)+'&edditinal='+encodeURI(document.getElementById("edditinal").value)+'&capture_input=0';

 	http_request = false;

      	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType)
		{
                	// set type accordingly to anticipated content type
               		http_request.overrideMimeType('text/html');
            	}
        }
	else if (window.ActiveXObject)
	{ // IE
         try
		{
            		http_request = new ActiveXObject("Msxml2.XMLHTTP");
         	}
		catch (e)
		{
            		try
			{
               			http_request = new ActiveXObject("Microsoft.XMLHTTP");
            		}
			catch (e) {}
         	}
        }

      if (!http_request)
	{
         alert('Cannot create XMLHTTP instance');
         return false;
      }

      http_request.onreadystatechange = GetCallOrderData;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);

}

function GetCallOrderData()
{
   if (http_request.readyState != 4)
   {

	document.getElementById('CallOrderAjaxloderImg').style.display='';
   }

    if (http_request.readyState == 4)
        {
         if (http_request.status == 200)
         {
            alert(http_request.responseText);
	    document.getElementById('CallOrderAjaxloderImg').style.display='none';
            result = http_request.responseText;


//проверка на ошибки ввода информации
	var check_err=result.substr(0,6);
	if (check_err=='error=')
        {


	  // обновление окна авторизации
		ind_start=6;
		ind_end=result.indexOf('[*@end@*]');
		//alert('start='+ind_start+'  end='+ind_end);
        	ind_end=ind_end-ind_start;

		UpdData=result.substr(ind_start,ind_end);
			document.getElementById('CallOrderData').innerHTML=UpdData;

			document.getElementById('oc_capcha_img').src ='capcha_pages.php?page=callorder&rnd=+Math.random()';

	}
	else // удачная авторизация
	{

		//alert(result);
		//var redirect_url=result;
		document.getElementById('CallOrderData').innerHTML=result;

		//window.location=redirect_url;
        }



         }
         else
         {
            alert('There was a problem with the request.');
	    //GetLoginData();
         }

	}
}


function GetFormOrderData()
{


    if (http_request.readyState == 4)
        {
         if (http_request.status == 200)
         {
            alert(http_request.responseText);
	    document.getElementById('CallOrderAjaxloderImg').style.display='none';
            result = http_request.responseText;
	    window.open('http://localhost/svitmob/form_order.php');
/*

//проверка на ошибки ввода информации
	var check_err=result.substr(0,6);
	if (check_err=='error=')
        {


	  // обновление окна авторизации
		ind_start=6;
		ind_end=result.indexOf('[*@end@*]');
		//alert('start='+ind_start+'  end='+ind_end);
        	ind_end=ind_end-ind_start;

		UpdData=result.substr(ind_start,ind_end);
			document.getElementById('CallOrderData').innerHTML=UpdData;

			document.getElementById('oc_capcha_img').src ='capcha_pages.php?page=callorder&rnd=+Math.random()';

	}
	else // удачная авторизация
	{

		//alert(result);
		//var redirect_url=result;
		document.getElementById('CallOrderData').innerHTML=result;

		//window.location=redirect_url;
        }
*/


         }
         else
         {
            alert('There was a problem with the request.');
	    //GetLoginData();
         }

	}
}







function InstreamCartDel(del_id,url) // удаление продукта из корзины
 {
   if (request == null)
     alert("Error creating request object!");
     //alert('url1='+url);
     request.open("GET",url,true);
     request.onreadystatechange = UpdateCartWindow;
     request.send(null);
 }



function ShoppingCartClear(url) // чистка всей корзины
{
    if (request == null)
     alert("Error creating request object!");
     request.open("GET",url,true);
     request.onreadystatechange = UpdateCartWindowClear;
     request.send(null);
/**/

}

function UpdateCartWindowClear()
{
  if (request.readyState == 4)
    {

      if (request.status == 200)
      {
       /* Получение ответа от сервера */
       var updatedText = request.responseText;
	if (updatedText.length>0)
	{
		while(updatedText.indexOf(',')>0) // очистка значений на кнопках
		{
			UpdatFieldID=updatedText.substr(0,updatedText.indexOf(','));
			updatedText=updatedText.substr( (updatedText.indexOf(','))+1);
			ResestCartFields(UpdatFieldID,'0');
		}

	}

       document.getElementById("Cart_Window").innerHTML = '<center>Корзина пуста</center>';
       document.getElementById("cart_count_box").innerHTML = 0;
	document.getElementById("cart_summ_box").innerHTML = 0;

      }
    }

}



function UpdateCartFields(loader_id)
  {


    if (request.readyState == 4)
    {
      //alert('in'+request.status);
      if (request.status == 200)
      {
       /* Получение ответа от сервера */
       var updatedText = request.responseText;
		//alert(updatedText);


/* 1. Получаем id продукта  */

	//alert('upd_txt'+updatedText);
		var ind_start=updatedText.indexOf('updfield_id=');
		var ind_end=updatedText.indexOf('[*-&cq-*]');
		ind_start=ind_start+12;
		ind_end=ind_end-ind_start;
		UpdatFieldID=updatedText.substr(ind_start,ind_end);

/* 2. Общее кол-во и сумма в корзине */

		ind_start=updatedText.indexOf('total=');
			ind_start=ind_start+6;

		ind_end=updatedText.indexOf('[*-&tc-*]');
			ind_end=ind_end-ind_start;
		UpdatT=updatedText.substr(ind_start,ind_end);
		var Check_UpdatFieldID_COUNT='cart_count_box';
		  //UpdateElement(Check_UpdatFieldID,UpdatT,1);

			ind_start=updatedText.indexOf('total_sum=');
			ind_start=ind_start+10;

			ind_end=updatedText.indexOf('[*-&ts-*]');
			ind_end=ind_end-ind_start;
			UpdatTotal=updatedText.substr(ind_start,ind_end);
			var Check_UpdatFieldID_SUMM='cart_summ_box';
			float_val=parseInt(UpdatTotal);
			//float_val=float_val.toFixed(2);

			  //UpdateElement(Check_UpdatFieldID,float_val,1);
			//alert(document.getElementById("windowOpen").title);
			//alert(UpdatT);
			if(UpdatT>0)
			{
				var sumTot=Number(UpdatTotal);
				    sumTot=sumTot.toFixed(2);

				document.getElementById("windowOpen").title= 'В корзине товаров: '+UpdatT+'   на сумму: '+sumTot;
				alert('Товар добалвен в корзину');
				UpdateElement(Check_UpdatFieldID_COUNT,UpdatT,1);
				UpdateElement(Check_UpdatFieldID_SUMM,float_val,1);


			}
			else
			{
				document.getElementById("windowOpen").title= 'Корзина пуста';
				UpdateElement(Check_UpdatFieldID_COUNT,'',1);
				UpdateElement(Check_UpdatFieldID_SUMM,'',1);
			}
			//alert(document.getElementById("windowOpen").title);

/*  3. Обновляем данные в окне корзины */

		ind_start=updatedText.indexOf('cart_win=');
			ind_start=ind_start+9;

		ind_end=updatedText.indexOf('[*-&cw-*]');
			ind_end=ind_end-ind_start;
		UpdatWinData=updatedText.substr(ind_start,ind_end);

					start=UpdatWinData.indexOf('<!--CartTotal[');
					end=UpdatWinData.indexOf(']//-->');
					tot_res=UpdatWinData.substr(start+14,(end-(start+14)));
					document.getElementById('CartWinTotal').innerHTML='Итого к оплате: '+tot_res;

			UpdateElement('Cart_Window',UpdatWinData,1);

/*  4. Текущее кол-во выбранного продукта в корзине + обновление кол-ва на кнопках */

		ind_start=updatedText.indexOf('cur_count=');
			ind_start=ind_start+10;

		ind_end=updatedText.indexOf('[*-&cc-*]');
			ind_end=ind_end-ind_start;
		UpdatFieldCount=updatedText.substr(ind_start,ind_end);
		//alert('this reset id='+UpdatFieldID+'  count='+UpdatFieldCount);
		//ResestCartFields(UpdatFieldID,UpdatFieldCount);

		//$("#"+loader_id).fadeOut(1000);
		//document.getElementById("ajax_work").value=0;



      }
    }
  }


function InstreamCartAdd(url) // добавление в корзину
 {

    //var url='cart.php?cart_add_item='+prod_id;
	//alert('url='+url);
   if (request == null)
     alert("Error creating request object!");
     request.open("GET",url,true);
     request.onreadystatechange = UpdateCartFields;
     request.send(null);


 }


function UpdateElement(obj,obj_value,type)
{

   if(type==1)
   {

	if (document.getElementById(obj)!=null)
			document.getElementById(obj).innerHTML=obj_value;
   }
   else if(type==0)
   {
	if (document.getElementById(obj)!=null)
			document.getElementById(obj).value = obj_value;
   }

}






function UpdateCartWindow()
  {

    if (request.readyState == 4)
    {

      if (request.status == 200)
      {
       /* Получение ответа от сервера */
       var updatedText = request.responseText;
	//alert(updatedText);

/* Обновление данных на кнопках */
	var ind_start=updatedText.indexOf('item_id=');
	var ind_start=ind_start+8;
	ind_end=updatedText.indexOf('#$@$#');
        ind_end=ind_end-ind_start;
	UpdIdProd=updatedText.substr(ind_start,ind_end);
	//alert('upd='+UpdIdProd+' start='+ind_start+'  end='+ind_end);

		ResestCartFields(UpdIdProd,0);

	ind_start=updatedText.indexOf('instream_cartdel_start');
	ind_end=updatedText.indexOf('instream_cartdel_end');
        var tot_c=updatedText.indexOf('#$@$#')+5;

	updatedText=updatedText.substr(0,ind_end);
        updatedCount=updatedText.substr(tot_c,(ind_start-tot_c));


	ind_start=updatedText.indexOf('total_sum=');
	ind_start=ind_start+10;
	ind_end=updatedText.indexOf('#$[tcs]$#');
	ind_end=ind_end-ind_start;
	updatedSum=updatedText.substr(ind_start,ind_end);


        if (updatedCount=='') {updatedCount=0;}
         ind_start=ind_start+52;
	updatedText=updatedText.substr(ind_start);
	//alert(updatedText);
/* Обновление формы */
       document.getElementById("Cart_Window").innerHTML = updatedText;
	document.getElementById("cart_count_box").innerHTML = updatedCount;
	document.getElementById("cart_summ_box").innerHTML = updatedSum;

      }
    }
  }


var request = null;
   try
	{
     		request = new XMLHttpRequest();
   	}
   catch (trymicrosoft)
	{
     	try {
       		request = new ActiveXObject("Msxml2.XMLHTTP");
     	    }
        catch (othermicrosoft)
	   {
        try
	   {
         	request = new ActiveXObject("Microsoft.XMLHTTP");
       	   }
        catch (failed)
	   {
         request = null;
           }
        }
   }


/***  MENU ***/
var expandFirstItemAutomatically = false;	// Expand first menu item automatically ?
var initMenuIdToExpand = false;	// Id of menu item that should be initially expanded. the id is defined in the <li> tag.
var expandMenuItemByUrl = true;	// Menu will automatically expand by url - i.e. if the href of the menu item is in the current location, it will expand


var initialMenuItemAlwaysExpanded = true;	// NOT IMPLEMENTED YET

var dhtmlgoodies_slmenuObj;
var divToScroll = false;
var ulToScroll = false;
var divCounter = 1;
var otherDivsToScroll = new Array();
var divToHide = false;
var parentDivToHide = new Array();
var ulToHide = false;
var offsetOpera = 0;
if(navigator.userAgent.indexOf('Opera')>=0)offsetOpera=1;
var slideMenuHeightOfCurrentBox = 0;
var objectsToExpand = new Array();
var initExpandIndex = 0;
var alwaysExpanedItems = new Array();

function popMenusToShow()
{
	var obj = divToScroll;
	var endArray = new Array();
	while(obj && obj.tagName!='BODY'){
		if(obj.tagName=='DIV' && obj.id.indexOf('slideDiv')>=0){
			var objFound = -1;
			for(var no=0;no<otherDivsToScroll.length;no++){
				if(otherDivsToScroll[no]==obj){
					objFound = no;
				}
			}
			if(objFound>=0){
				otherDivsToScroll.splice(objFound,1);
			}
		}
		obj = obj.parentNode;
	}
}

function showSubMenu(e,inputObj)
{
	redirect_link=false;
  //alert('e='+e+'  obj='+inputObj);
	if(this && this.tagName)inputObj = this.parentNode;
	if(inputObj && inputObj.tagName=='LI')
	{
		divToScroll = inputObj.getElementsByTagName('DIV')[0];
		for(var no=0;no<otherDivsToScroll.length;no++)
		{
			if(otherDivsToScroll[no]==divToScroll)return;
		}
	}
	hidingInProcess = false;
	if(otherDivsToScroll.length>0)
	{// alert('H1');
		if(divToScroll)
		{
			//alert('H1_1');
			if(otherDivsToScroll.length>0){
				popMenusToShow();
			}
			if(otherDivsToScroll.length>0){
				autoHideMenus();
				hidingInProcess = true;
			}
			redirect_link=false;
		}
		else
		{
         	//alert('H1_2');
         	redirect_link=true;
		}
	}
	if(divToScroll && !hidingInProcess)
	{
		//alert('H2')
		divToScroll.style.display='';
		otherDivsToScroll.length = 0;
		otherDivToScroll = divToScroll.parentNode;
		otherDivsToScroll.push(divToScroll);
		while(otherDivToScroll && otherDivToScroll.tagName!='BODY'){
			if(otherDivToScroll.tagName=='DIV' && otherDivToScroll.id.indexOf('slideDiv')>=0){
				otherDivsToScroll.push(otherDivToScroll);

			}
			otherDivToScroll = otherDivToScroll.parentNode;
		}
		ulToScroll = divToScroll.getElementsByTagName('UL')[0];
		if(divToScroll.style.height.replace('px','')/1<=1)scrollDownSub();
	}


	if (redirect_link==false)
	{
		return false;
	}

}



function autoHideMenus()
{
	if(otherDivsToScroll.length>0){
		divToHide = otherDivsToScroll[otherDivsToScroll.length-1];
		parentDivToHide.length=0;
		var obj = divToHide.parentNode.parentNode.parentNode;
		while(obj && obj.tagName=='DIV'){
			if(obj.id.indexOf('slideDiv')>=0)parentDivToHide.push(obj);
			obj = obj.parentNode.parentNode.parentNode;
		}
		var tmpHeight = (divToHide.style.height.replace('px','')/1 - slideMenuHeightOfCurrentBox);
		if(tmpHeight<0)tmpHeight=0;
		if(slideMenuHeightOfCurrentBox)divToHide.style.height = tmpHeight  + 'px';
		ulToHide = divToHide.getElementsByTagName('UL')[0];
		slideMenuHeightOfCurrentBox = ulToHide.offsetHeight;
		scrollUpMenu();
	}else{
		slideMenuHeightOfCurrentBox = 0;
		showSubMenu();
	}
}


function scrollUpMenu()
{

	var height = divToHide.offsetHeight;
	height-=5;
	if(height<0)height=0;
	divToHide.style.height = height + 'px';

	for(var no=0;no<parentDivToHide.length;no++){
		parentDivToHide[no].style.height = parentDivToHide[no].getElementsByTagName('UL')[0].offsetHeight + 'px';
	}
	if(height>0){
		setTimeout('scrollUpMenu()',5);
	}else{
		divToHide.style.display='none';
		otherDivsToScroll.length = otherDivsToScroll.length-1;
		autoHideMenus();
	}
}

function scrollDownSub()
{
	if(divToScroll){
		var height = divToScroll.offsetHeight/1;
		var offsetMove =Math.min(5,(ulToScroll.offsetHeight - height));
		height = height +offsetMove ;
		divToScroll.style.height = height + 'px';

		for(var no=1;no<otherDivsToScroll.length;no++){
			var tmpHeight = otherDivsToScroll[no].offsetHeight/1 + offsetMove;
			otherDivsToScroll[no].style.height = tmpHeight + 'px';
		}
		if(height<ulToScroll.offsetHeight)setTimeout('scrollDownSub()',5); else {
			divToScroll = false;
			ulToScroll = false;
			if(objectsToExpand.length>0 && initExpandIndex<(objectsToExpand.length-1)){
				initExpandIndex++;

				showSubMenu(false,objectsToExpand[initExpandIndex]);
			}
		}
	}
}

function initSubItems(inputObj,currentDepth)
{
	divCounter++;
	var div = document.createElement('DIV');	// Creating new div
	div.style.overflow = 'hidden';
	div.style.position = 'relative';
	div.style.display='none';
	div.style.height = '1px';
	div.id = 'slideDiv' + divCounter;
	div.className = 'slideMenuDiv' + currentDepth;
	inputObj.parentNode.appendChild(div);	// Appending DIV as child element of <LI> that is parent of input <UL>
	div.appendChild(inputObj);	// Appending <UL> to the div
	var menuItem = inputObj.getElementsByTagName('LI')[0];
	while(menuItem)
	{
		if(menuItem.tagName=='LI')
		{
			var aTag = menuItem.getElementsByTagName('A')[0];
			aTag.className='slMenuItem_depth'+currentDepth;
			var subUl = menuItem.getElementsByTagName('UL');
			if(subUl.length>0){
				initSubItems(subUl[0],currentDepth+1);
			}
			aTag.onclick = showSubMenu;
		}
		menuItem = menuItem.nextSibling;
	}
}

function initSlideDownMenu()
{
	dhtmlgoodies_slmenuObj = document.getElementById('dhtmlgoodies_slidedown_menu');
	dhtmlgoodies_slmenuObj.style.visibility='visible';
	var mainUl = dhtmlgoodies_slmenuObj.getElementsByTagName('UL')[0];
	var mainMenuItem = mainUl.getElementsByTagName('LI')[0];
	mainItemCounter = 1;
	while(mainMenuItem)
	{
		if(mainMenuItem.tagName=='LI')
		{
			var aTag = mainMenuItem.getElementsByTagName('A')[0];
			aTag.className='slMenuItem_depth1';
			var subUl = mainMenuItem.getElementsByTagName('UL');
			if(subUl.length>0)
			{
				mainMenuItem.id = 'mainMenuItem' + mainItemCounter;
				initSubItems(subUl[0],2);
				aTag.onclick = showSubMenu;
				mainItemCounter++;
			}
		}
		mainMenuItem = mainMenuItem.nextSibling;
	}

	if(location.search.indexOf('mainMenuItemToSlide')>=0)
	{   //alert('here1');
		var items = location.search.split('&');
		for(var no=0;no<items.length;no++)
		{
			if(items[no].indexOf('mainMenuItemToSlide')>=0){
				values = items[no].split('=');
				showSubMenu(false,document.getElementById('mainMenuItem' + values[1]));
				initMenuIdToExpand = false;
			}
		}
	}
	else if(expandFirstItemAutomatically>0)
	{   //alert('here2');
		if(document.getElementById('mainMenuItem' + expandFirstItemAutomatically)){
			showSubMenu(false,document.getElementById('mainMenuItem' + expandFirstItemAutomatically));
			initMenuIdToExpand = false;
		}
	}

	if(expandMenuItemByUrl)
	{
		var aTags = dhtmlgoodies_slmenuObj.getElementsByTagName('A');
		for(var no=0;no<aTags.length;no++){
			var hrefToCheckOn = aTags[no].href;
			//alert(hrefToCheckOn);
			if(location.href.indexOf(hrefToCheckOn)>=0 && hrefToCheckOn.indexOf('#')<hrefToCheckOn.length-1)
			{
				initMenuIdToExpand = false;
				var obj = aTags[no].parentNode;
				while(obj && obj.id!='dhtmlgoodies_slidedown_menu')
				{
					if(obj.tagName=='LI'){
						var subUl = obj.getElementsByTagName('UL');
						if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
						if(subUl.length>0){
							objectsToExpand.unshift(obj);
						}
					}
					obj = obj.parentNode;
				}
				showSubMenu(false,objectsToExpand[0]);
				break;
			}
		}
	}

	if(initMenuIdToExpand)
	{
		objectsToExpand = new Array();
		var obj = document.getElementById(initMenuIdToExpand)
		while(obj && obj.id!='dhtmlgoodies_slidedown_menu'){
			if(obj.tagName=='LI'){
				var subUl = obj.getElementsByTagName('UL');
				if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
				if(subUl.length>0){
					objectsToExpand.unshift(obj);
				}
			}
			obj = obj.parentNode;
		}

		showSubMenu(false,objectsToExpand[0]);

	}



}


function CloseWindows()
{

document.getElementById('Window3').style.display='none';
document.getElementById('Window1').style.display='none';
document.getElementById('Window2').style.display='none';
document.getElementById('Window5').style.display='none';
document.getElementById('Window6').style.display='none';
document.getElementById('Window7').style.display='none';
document.getElementById('Window8').style.display='none';
document.getElementById('Window10').style.display='none';

document.getElementById('CompareWindow').style.display='none';
document.getElementById('OnlineSupportWindow').style.display='none';

//document.getElementById('ajaxloderimg').style.display='none';

}


function BuildInStreamWin(WinType,CID,cPath)
{

//alert(WinType);

CloseWindows();






     document.getElementById('CallOrderData').style.display='none';
     document.getElementById('callorder_loader').style.display='';


	document.getElementById('FAQBoxData').style.display='none';
        document.getElementById('faq_loader').style.display='';

		document.getElementById('WantDiscountData').style.display='none';
        	document.getElementById('wd_loader').style.display='';

			document.getElementById('FollowData').style.display='none';
        		document.getElementById('fl_loader').style.display='';


				document.getElementById('CartAllData').style.display='none';
        			document.getElementById('cart_loader').style.display='';

					document.getElementById('FormOrderData').style.display='none';
        				document.getElementById('fo_loader').style.display='';



      if(CID!='') CID='&isID='+CID;
      if(cPath!='') cPath='&cPath='+cPath;

     url='build_instream_win.php?win_type='+WinType+cPath+CID;
	//alert(url);
     if (request == null)
     alert("Error creating request object!");
     request.open("GET",url,true);
     request.onreadystatechange =  function()
     {
	if (request.readyState == 4)
    	{

	      if (request.status == 200)
      		{
		       /* Получение ответа от сервера */

			var res_txt = request.responseText;
			//alert(res_txt);
			switch (WinType)
			{
			   case 'CallOrder':
      					//alert(document.getElementById('CallOrderData').innerHTML);


					document.getElementById('CallOrderData').innerHTML=res_txt;
						$("#CallOrderData").fadeIn(1000);
						$("#callorder_loader").fadeOut(1000);

     			 	break;

   			   case 'FAQ':
      					//alert(document.getElementById('CallOrderData').innerHTML);


					document.getElementById('FAQBoxData').innerHTML=res_txt;
						$("#FAQBoxData").fadeIn(1000);
						$("#faq_loader").fadeOut(1000);

     			 	break;

			   case 'Compare':

					//alert('here='+res_txt);
					document.getElementById('CompareWindowData').innerHTML=res_txt;
					if (document.getElementById('log_err_msg')!=null) { document.getElementById('log_err_msg').innerHTML=''; } document.getElementById('email_address').value=''; document.getElementById('password').value=''; document.getElementById('log_submit_btn').className='prod_btn black_btn_dis';

     			 	break;

			   case 'LoginBox':

					//alert('here='+res_txt);
					document.getElementById('LogBlockData').innerHTML=res_txt;

     			 	break;

			   case 'WantDiscount':

					//alert('WD');

					document.getElementById('WantDiscountData').innerHTML=res_txt;
					document.getElementById('want_discount_prod').innerHTML=document.getElementById('wd_flag').value;

					obj=document.getElementById('WantDiscount_Btn');
					fireEvent(obj,'click');

						$("#WantDiscountData").fadeIn(1000);
						$("#wd_loader").fadeOut(1000);

					document.getElementById('wd_prod_hid').value=document.getElementById('wd_flag').value;

     			 	break;

			  case 'Follow':

					//alert('FL');


					document.getElementById('FollowData').innerHTML=res_txt;

					var prod_name=document.getElementById('fl_flag').value;
					//alert(prod_name);

					obj=document.getElementById('Follow_Btn');
					fireEvent(obj,'click');

						$("#FollowData").fadeIn(1000);
						$("#fl_loader").fadeOut(1000);
					document.getElementById('follow_prod_hid').value=prod_name;
					document.getElementById('follow_prod').innerHTML=prod_name;
					//alert(document.getElementById('follow_prod_hid').value);

     			 	break;

			  case 'FormOrder':



					document.getElementById('FormOrderData').innerHTML=res_txt;

					var prod_name=document.getElementById('fl_flag').value;
					//alert(prod_name);

					obj=document.getElementById('OrderForm_Btn');
					fireEvent(obj,'click');

						$("#FormOrderData").fadeIn(1000);
						$("#fo_loader").fadeOut(1000);

     			 	break;


			 case 'InstreamCart':

					//alert(res_txt);
					document.getElementById('win_cart_data').innerHTML=res_txt;

						$("#CartAllData").fadeIn(1000);
						$("#cart_loader").fadeOut(1000);
					start=res_txt.indexOf('<!--CartTotal[');
					end=res_txt.indexOf(']//-->');
					tot_res=res_txt.substr(start+14,(end-(start+14)));
					//alert(tot_res);
					document.getElementById('CartWinTotal').innerHTML='Итого к оплате: '+tot_res;

     			 	break;


			   default:
      					j=k;
      				break;
			}

			//alert(res_txt);

      		}
	 }

      }
     request.send(null);



}



function nav(){
	$("div#nav ul li").mouseover(function() {
			$(this).find('ul:first').show();
	});

	$("div#nav ul li").mouseleave(function() {
		$("div#nav ul li ul").hide();
	});

	$("div#nav ul li ul").mouseleave(function() {
		$("div#nav ul li ul").hide();
	});

};
$(document).ready(function(){
	nav();
});


  $(document).ready(function()
      {
        $('#CartOpen').click(function()
        {
          $('#Window3').AeroWindow(
          {
            WindowTitle:        '<span style="color:#fff">&nbsp;КОРЗИНА ТОВАРОВ</span>',
            WindowPositionTop:  'center',
            WindowPositionLeft: 'center',
            WindowWidth:        650,
            WindowHeight:       400,
            WindowAnimation:    'easeInOutSine',
            WindowResizable:    true,
            WindowDraggable:    true,
            WindowMinimize:     true,
            WindowMaximize:     true,
            WindowClosable:     true
          });
        })
      });



 var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18215981-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

   function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}

function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return false;
}






