﻿var ErorrSendLinkMobile = "המספר שהוקש אינו תקין";
var SendLinkMobile = "לינק לפורטל נשלח למכשירך";


$(document).ready(function(){                  
        $(".PlusIcon").toggle( 
            function(){ 
                $(this).addClass("MinusIcon");
                $(this).removeClass("PlusIcon");
                }, 
            function () {
                $(this).addClass("PlusIcon");
                $(this).removeClass("MinusIcon");}
        );
         
        $(".PlusIcon").click(function () {                       
           $(this).next().next().next().toggle();}
        );        
   
   
   
    var lastSelect = $(".BtnSelected");
      $('.BtnsCont').find('div').click(function(e) 
      {  
        $(lastSelect).removeClass("BtnSelected");
        $(lastSelect).addClass("Btn");
        
        $(this).addClass("BtnSelected");  
        lastSelect = this;
                                                             
        $(".Content").css("display","none");                     
        $('#' + $(this).attr('alt')).css("display","block");
                    
        return false;            
      }); 
      
      
      var lastSelect = $(".tab_on");
      $('.iphone_tab').find('.A13').click(function(e) 
      {  
        $(lastSelect).removeClass("tab_on");
        $(lastSelect).addClass("tab_off");
                        
        $(this).removeClass("tab_off");
        $(this).addClass("tab_on");  
        
       
                                                             
        $('#' + $(lastSelect).attr('alt')).css("display","none");                   
        $('#' + $(this).attr('alt')).css("display","block");

        lastSelect = this;                    
        return false;            
      });     
      
      
      $("Body").keypress(function (e) {          
            if(e.which == 13 )    
            {       
                Search();
                return false;            
            }
      });  
      
     $(".InputNum").keypress(function(e) {
        if (e.whice != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) return false;
    })                
})


function Search()
{
    var sval = $("#SearchInput").val();
       
    if(sval != "")  
    {
       window.location = " http://www.orange.co.il/145.html?q=" + sval;    
    }
}

function CheckTimeout (id, name)
{
	var banner = document.getElementById(name + "$ad$" + id);
	
	if(banner == null || banner.childNodes == null || banner.childNodes.length == 0)
	{
		if(banner != null)
			banner.style.display = "none";
		
		var def = document.getElementById(name + "$def$" + id);
		def.style.display = ""		
	}
}

function SendToMobile()
{                  
    var pre_input = $(".pre_input").val();
    var long_input = $(".long_input").val();
        
    if(pre_input != "" && long_input != "")
    {       
        $.post("iphone/Handlers/IphoneHandler.ashx", {action : "SendToMobile", mobile : pre_input + long_input },
        function(data)
        {                                 
           ShowMSG(data);                                   
        });                        
    }                          
}

function ShowMSG(res)
{
     $(".pre_input").val("");
     $(".long_input").val("");
     
     $(".form_lineMSG").css("display","block");
     $(".form_lineInput").css("display","none"); 
     
     if(res == "true")
     {                                                     
        $(".form_lineMSG").html(SendLinkMobile);    
     }
     else
     {
        $(".form_lineMSG").html(ErorrSendLinkMobile); 
     }  
     
     setTimeout("ShowInputView()",2000);       
}

function ShowInputView()
{
    $(".form_lineMSG").css("display","none");
    $(".form_lineInput").css("display","block"); 
}


function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
$("."+destination).focus();
}