﻿$(function()
{
  $("#news").easySlider({
	  auto: true,
	  speed:1000,
	  prevText:'',
	  nextText:'',
	  stopText:'',
	  playText:'',
	  pause:7000,
	  continuous:true
  });
  
  //light Box
  $("a[href='membership.aspx'],a[href='../membership.aspx']").colorbox({width:"80%", height:"96%", iframe:true});
  $("a[href='forgottenPassword.aspx']").colorbox({width:"50%", height:"50%", iframe:true});
  $("a[href='resendActivationMail.aspx']").colorbox({width:"50%", height:"50%", iframe:true});
  $("a[href='users/changePass.aspx']").colorbox({width:"50%", height:"50%", iframe:true});
  $("a[href='users/changeAccount.aspx']").colorbox({width:"65%", height:"93%", iframe:true});
  $("a[href='users/unsubscribe.aspx']").colorbox({width:"50%", height:"35%", iframe:true});
  
  $(".favorites").jFav();
  $("#pikame").PikaChoose({user_thumbs:false,show_prev_next:false});
  $('#menu li a').each(function()
  {
    if($('title:contains("'+$(this).text()+'")').text()!="")
     $(this).parent().addClass('home');
    
    //if($('title:contains("پایگاه")').text()!="")
     //{
      $('#menu li a:contains("صفحه اصلی")').addClass('home');
     //}
  });

  $('.box,.lBoxHeader,.cheader,.rheader,.head').corner("top");
    
  
  $('<div class="spacer"></div').appendTo('.active');
  $('#r_menu li a:not(.head)').mouseover(function()
  {
    $(this).append('<div class="linkimg"></div>');
  });
  $('#r_menu li a').mouseout(function()
  {
   $('#r_menu li a div').remove();
  });
  
  
  
  $('.cheader div,.lBoxHeader div').each(function()
  {
   $(this).addClass('arrowL');
  })
 
   
   $('.lBoxHeader span').click(function()
  {
   var item=$(this).parent().next();
   var div=$(this).prev();
   item.slideToggle('medium',function(){
     if(div.hasClass('arrowB'))
      {
       div.removeClass('arrowB');
       div.addClass('arrowL');
      }
     else
      {
       div.removeClass('arrowL');
       div.addClass('arrowB');
      }
   });
   });
   
   $('.close').addClass('display');
   $('#images li img').mouseover(function()
   {
     var url=$(this).attr('src');
     var str=url.split('&');
     var path=url.split('?');
     var lenght=path[1].indexOf('&');
     url=path[1].substring(5,lenght)+str[1].substring(5);
     $('#showImage img').attr('src',url);
     $('#showImage img').css('border','solid 1px #555');
     $('#showImage').slideDown('medium');
     $('#showImage img').fadeIn('slow');
     $('.close').removeClass('display');
   });

   
  $('.cheader span').click(function()
  {
   var item=$(this).parent().next();
   var arrow=$(this).prev();
   item.slideToggle('medium',function(){
     if(arrow.hasClass('arrowB'))
      {
       arrow.removeClass('arrowB');
       arrow.addClass('arrowL');
      }
     else
      {
       arrow.removeClass('arrowL');
       arrow.addClass('arrowB');
      }
   });
   });
   
   $('.close').click(function()
  {
   $('#showImage').slideToggle('medium');
   $(this).addClass('display');
  });
  
  var fontsize=12;
  $('#plus').click(function()
  {
   if(fontsize<=15)
    {fontsize+=1;
    $('.contentstyle,.contentstyle div,.contentstyle p,.contentstyle span,.contentstyle a').css('font-size',fontsize.toString()+"px");
    }
  });
  
  $('#min').click(function()
  {
    if(fontsize>=9)
    {fontsize-=1;
    $('.contentstyle,.contentstyle div,.contentstyle p,.contentstyle span,.contentstyle a').css('font-size',fontsize.toString()+"px");
    }
  });
  
//  jQuery('#navigation').accordion({
//			active: true,
//			header: '.head',
//			navigation: false,
//			event: 'mouseover',
//			fillSpace: false,
//			animated: 'easeslide',
//			autoheight: false 
//		});
  
});

function GetXmlHttpObject()
{
var xmlHttp=null;

try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
