var browser=navigator.appName;
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);

function ShowDropDown(Obj, MenuObj) {

	//sname = document.getElementById(MenuObj+'_link').innerHTML;
  //document.getElementById(Obj+'_name').innerHTML = sname;
	
	// Position setup
	
	if (browser == 'Microsoft Internet Explorer') { 
		
		if (version == 8) { // there are some differences between ie8 and other browsers in terms of positioning
			wxpos = -7;	
			wypos = 10;
		}
	
		if (version == 7) { // there are some differences between ie7 and other browsers in terms of positioning
			wxpos = parseInt(document.getElementById("WebSite").offsetLeft)+9;	
			
			wypos = parseInt(document.getElementById("Header").offsetHeight)+5;
	
		}
	}	
	else { // some adjusmets for drop downs position
		wxpos = -6;	
		wypos = 9;
	}
	
	if (document.getElementById(MenuObj).className == 'first') {
		wxpos = wxpos-15;
	}
	
	xpos = parseInt(document.getElementById(MenuObj).offsetLeft)+wxpos;
	ypos = parseInt(document.getElementById(MenuObj).offsetTop)+wypos;

	document.getElementById(Obj).style.left = xpos+'px';
	document.getElementById(Obj).style.top = ypos+'px';

	// end position setup
	
	$("#"+Obj).css("opacity", "0").css("display", "block").animate({opacity:"1"}, 500);
	

}

function ShowDropDown1(Obj, MenuObj) {

	$("#"+Obj).css("display", "block");
	
}

function HideDropDown(Obj) {
	
	$("#"+Obj).css("display", "none");

}


function ButtonEffects() {


	
   $("div.PhotoGallery > div > div > span").mouseover(function() {
		//alert($(this));
  	$(this).clearQueue();
  	//$(this).addClass('hover');
  	//$(this).css("opacity", "0.4");
		$(this).animate({opacity: "0.5"}, 500);    	
	
	});
	
   $("div.ArticleImages > div > div > span").mouseover(function() {
		//alert($(this));
  	$(this).clearQueue();
  	//$(this).addClass('hover');
  	//$(this).css("opacity", "0.4");
		$(this).animate({opacity: "0.5"}, 500);    	
	
	});	
   		
    
   $("div.PhotoGallery > div > div > span").mouseout(function() {
		//$(this).clearQueue();
		$(this).animate({opacity: "1"}, 400);    	
	
	});	
	
	 $("div.ArticleImages > div > div > span").mouseout(function() {
		//$(this).clearQueue();
		$(this).animate({opacity: "1"}, 400);    	
	
	});	
	

   $("a.Button").mouseover(function() {

  	$(this).clearQueue();
  	$(this).addClass('hover');
  	$(this).css("opacity", "0.4");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
   		
    
   $("a.Button").mouseout(function() {

		$(this).removeClass('hover').delay(500);
	
	});
	
	

   $("span.Button").mouseover(function() {

  	$(this).clearQueue();
  	$(this).addClass('hover');
  	$(this).css("opacity", "0.4");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
   		
    
   $("span.Button").mouseout(function() {

		$(this).removeClass('hover').delay(500);
	
	});	

	
  $("#searchsubmit").mouseover(function() {

  	$(this).clearQueue();
  	$(this).addClass('hover');
  	$(this).css("opacity", "0.4");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
   		
    
   $("#searchsubmit").mouseout(function() {

		$(this).removeClass('hover').delay(500);
	
	});	
	

  $("span.sociallink").mouseover(function() {

  	$(this).clearQueue();
  	$(this).addClass('hover');
  	$(this).css("opacity", "0.8");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
   		
    
   $("span.sociallink").mouseout(function() {

		$(this).removeClass('hover').delay(500);
	
	});		
	
	
 
	
	
   $("a.THH").mouseover(function() {

  	$('#'+this.id+'_b').clearQueue();
  	$('#'+this.id+'_b').addClass('hover');
  	$('#'+this.id+'_b').css("opacity", "0.4");
		$('#'+this.id+'_b').animate({opacity: "1"}, 500);
	
	});
	
   $("a.THH").mouseout(function() {

  	$('#'+this.id+'_b').removeClass('hover');
	
	});		
	
  $("a.THT").mouseover(function() {

  	$('#'+this.id+'_b').clearQueue();
  	$('#'+this.id+'_b').addClass('hover');
  	$('#'+this.id+'_b').css("opacity", "0.4");
		$('#'+this.id+'_b').animate({opacity: "1"}, 500);
	
	});
	
   $("a.THT").mouseout(function() {

  	$('#'+this.id+'_b').removeClass('hover');
	
	});			
   		
    
	
   $("input").focus(function() {

  	$(this).clearQueue();
  	$(this).addClass('focus');
  	$(this).css("opacity", "0.6");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
	
	$("input").focusout(function() {

		$(this).removeClass('focus').delay(500);
	
	});
	
  $("textarea").focus(function() {

  	$(this).clearQueue();
  	$(this).addClass('focus');
  	$(this).css("opacity", "0.6");
		$(this).animate({opacity: "1"}, 500);    	
	
	});
	
	$("textarea").focusout(function() {

		$(this).removeClass('focus').delay(500);
	
	});	
	
  $("select").focus(function() {

  	$(this).clearQueue();
  	$(this).addClass('focus');
  	//$(this).css("opacity", "0.6");
		//$(this).animate({opacity: "1"}, 500);    	
	
	});
	
	$("select").focusout(function() {

		$(this).removeClass('focus').delay(500);
	
	});		
   		
    
   $("#Menu").mouseover(function() {

  	$("#Glow").clearQueue();
  	$("#Glow").removeClass('inactive').addClass('active');
  	$("#Glow").animate({opacity: "1"}, 500);
	
	});
	
	 $("#Menu").mouseout(function() {

  	$("#Glow").clearQueue();
  	$("#Glow").animate({opacity: "0"}, 500);
  	$("#Glow").removeClass('active').addClass('inactive');
	
	});
	var offset = $("#Menu").offset();
	
	$("#Menu").bind('mousemove',function(e){

		if(parseInt(e.pageX-offset.left-53) > 0 && parseInt(e.pageX-offset.left-53) < 640)	{
		$("#Glow").css({display: "block", marginLeft: e.pageX-offset.left-53});
		}
		else {
			if (parseInt(e.pageX-offset.left-53) >= 640) {
				$("#Glow").css({display: "none"});
			}
		}


	});


   $("select").change(function () {
          var str = "";
          $("select option:selected").each(function () {
                str += $(this).text() + " ";
              });
          $(this).parent().children("span").text(str);
        })
        .change();


}


