﻿	$(document).ready(function(){
		//gradient.Vertical('bd', '#FFFFFF','#E8E8E8');
		var currentPage = document.URL.substring(document.URL.lastIndexOf('/')+1);
		$("li a", "#selectedMenu").each(function(){
			if($(this).attr('href') == currentPage){
				$(this).parent().attr({'id': 'current'});
			}else{
				if(currentPage != "index.php" && currentPage != ""){
					$(this).parent().attr({'id': 'none'});
				}
			}
		});
				
		$('#birthMsg').heartBeat();
		
		setTimeout("$('#login_container').slideDown('slow')",700);
		
		$usernameValue = "نام کاربری";
		$passwordValue = "رمز عبور";
		
			$("input:text#username,input:password#password").each(function(){
			$(this).focus(function(){
					$(this).attr({"value": ""});
					if(!isMinIE6){
						$(".focused").removeClass('focused');
						$(this).addClass('focused');
					}
				});
			$(this).blur(function(){
				if($(this).attr("value").length == 0 && $(this).attr("type")== "text"){
					$(this).attr({"value": $usernameValue});
				}else if($(this).attr("value").length == 0 && $(this).attr("type")== "password"){
					$(this).attr({"value": $passwordValue});
				}
					if(!isMinIE6){
						$(".focused").removeClass('focused');
					}
				});
			});			
		
		
		$("select option:even").css({'backgroundColor': '#D4D4FF'});
		$("select option:odd").css({'backgroundColor': '#FFFFEC'});
		
		var collapseIcon = 'images/bullet_toggle_minus.png';
		var expandIcon = 'images/bullet_toggle_plus.png';
		var icon;
		$('.sign').each(function(){
			var $section = $(this);
			if ($(this).is('.collapsed')){
				icon = expandIcon;
			}
			else if($(this).is('.expanded')){
				icon = collapseIcon;
			}
			$("<img alt='' />").attr({'src': icon, 'align': 'texttop'}).appendTo(this)
			.addClass('clickable')
			.click(function() {
			if ($section.is('.collapsed')) {
				$section.removeClass('collapsed').addClass('expanded');
				$(this).attr('src', collapseIcon);
				$section.parent().next().slideToggle('slow');
			}
			else if($section.is('.expanded')) {
				$section.removeClass('expanded').addClass('collapsed');
				$(this).attr('src', expandIcon);
				$section.parent().next().slideToggle('slow');
				}
			});
		});
	});
