$(document).ready(function() { // activates the promo slider

	

				//alert("**");



				



				

			$("#contactWidgetForm").ajaxForm(function() { 

      		

      		//$("#contactWidgetContent").css({backgroundColor: '#000000'});

      		//$("#contactWidgetContent").load(location.href+" #contactWidgetContent>*","");	 

      		if ($("#contactWidgetComments").val() == '') {

      			$("#message_yes").fadeOut(0);

      			$("#message_no").fadeIn(200);

      		}

      		else {

      			$("#message_no").fadeOut(0);

      			$("#message_yes").fadeIn(200);

      		}

      		

      		$("#submitContactWidget").val("submit request");

      		

         

       });  

       

       $("#contactForm").ajaxForm(function() { 

      		

      		//$("#contactWidgetContent").css({backgroundColor: '#000000'});

      		//$("#contactWidgetContent").load(location.href+" #contactWidgetContent>*","");	 

      		if ($("#contactComments").val() == '') {

      			$("#contactmessage_yes").fadeOut(0);

      			$("#contactmessage_no").fadeIn(200);

      		}

      		else {

      			$("#contactmessage_no").fadeOut(0);

      			$("#contactmessage_yes").fadeIn(200);

      		}

      		

      		$("#contactSubmit").val("submit request");

      		

         

       });  

       

       



	

	

});



function TopMenuHover() {



var obj = document.getElementById("TopMenu");   

var objs = obj.getElementsByTagName("a");   



	for (var i = 0; i < objs.length; i++) {   

   objs[i].onmouseover=function() {

   		$('#'+this.id).clearQueue();

			$('#'+this.id).animate({backgroundColor: "#333333"}, 500);

			$('#'+this.id).animate({color: "#FFFFFF"}, 500);    	

    }

   objs[i].onmouseout=function() {

   		$('#'+this.id).clearQueue();

			$('#'+this.id).animate({backgroundColor: "#828282"}, 500);

			$('#'+this.id).animate({color: "#FFFFFF"}, 500);    	

    }    

   }  



}





function HomepageThumbnails() {



var obj = document.getElementById("HomepageArticles");   

var objs = obj.getElementsByTagName("a");   



	for (var i = 0; i < objs.length; i++) {   

   objs[i].onmouseover=function() {

   		$('#'+this.id).clearQueue();

			$('#'+this.id).animate({backgroundColor: "#801717", color: "#FFFFFF"}, 500);

    }

   objs[i].onmouseout=function() {

   		$('#'+this.id).clearQueue();

			$('#'+this.id).animate({backgroundColor: "#FFFFFF", color: "#000000"}, 500);

    }    

   }  



}





function AccordionHomepage() {

	var obj = document.getElementById("Accordions");   

	var objs = obj.getElementsByTagName("div");   

	

	for (var i = 0; i < objs.length; i++) {   

				

		var sobj = document.getElementById(objs[i].id);   

		var sobjs = sobj.getElementsByTagName("h4");   

		

		for (var j = 0; j < sobjs.length; j++) {   

			

				//alert(sobjs[j].id);

			

				sobjs[j].onclick=function() {

			

					animateAccordion(this.id, this.parentNode.id);

			

				}

			

		}

	}

}



function animateAccordion(obj, container) {

	

	var sobj = document.getElementById(container);   

	var sobjs = sobj.getElementsByTagName("h4");   

		

	for (var j = 0; j < sobjs.length; j++) {  	

		

		if (sobjs[j].id == obj) {

			$('#'+sobjs[j].id+'-o').animate({height:'200', opacity:'1'}, {duration: 600, height: 'easeOutBounce'});

			$('#'+sobjs[j].id).animate({backgroundColor:'#FFFFFF', color:'#000000'}, {duration: 600});

			$('#'+sobjs[j].id+'-p').animate({height:'150', padding:'6px 6px 0px 6px', opacity:'1'}, {duration: 600, height: 'easeOutBounce'});

		}

		else {

			$('#'+sobjs[j].id+'-o').animate({height:'0', opacity:'0'}, {duration: 600, height: 'easeOutBounce'}).hide(0);

			$('#'+sobjs[j].id).animate({backgroundColor:'#000000', color:'#FFFFFF'}, {duration: 600});

			$('#'+sobjs[j].id+'-p').animate({height:'0', padding:'0', opacity:'0'}, {duration: 600, height: 'easeOutBounce'}).hide(0);

		}

		

	}

	

}











//single or page starts here





    function ShowGallery(videotype, linkaddress, showtype, window_w, window_h) {

    

    

    if (showtype == 'video') {

    	if (videotype == 'vimeo') {

    		

    		$('#PhotoGalleryWindow').html('<div id="PostGallery" style="width:0px; overflow: hidden;"><object width="'+window_w+'" height="'+window_h+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='+linkaddress+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id='+linkaddress+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+window_w+'" height="'+window_h+'"></embed></object></div>');

    	}

    	

    	if (videotype == 'youtube') {

    		

    		$('#PhotoGalleryWindow').html('<div id="PostGallery" style="width:0px; overflow: hidden;"><object width="'+window_w+'" height="'+window_h+'"><param name="movie" value="http://www.youtube.com/v/'+linkaddress+'&amp;hl=en_US&amp;fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+linkaddress+'&amp;hl=en_US&amp;fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+window_w+'" height="'+window_h+'"></embed></object></div>');

    	}

    	

    	if (videotype == 'selfhosted_ogv') {

    		$('#PhotoGalleryWindow').html('<div id="PostGallery" style="width:0px; overflow: hidden;"><div class="video-js-box"><video class="video-js" width="'+window_w+'" height="'+window_h+'" autoplay controls preload><source src="'+linkaddress+'" type=\'video/ogg; codecs="theora, vorbis"\'></video></div></div>');

    	}

    	

    	if (videotype == 'selfhosted') {

    		$('#PhotoGalleryWindow').html('<div id="PostGallery" style="width:0px; overflow: hidden;"><a href="'+linkaddress+'" style="display:block;width:'+window_w+'px;height:'+window_h+'px; "id="player2" class="player_popup"></a></div>');



				activate_video(linkaddress);



    	}    	

    	

    }

    	if (showtype == 'picture') {

    		$('#PhotoGalleryWindow').html('<div id="PostGallery" style="width:0px; overflow: hidden;"><img src="'+linkaddress+'" border=0></div>');

    	}

    	

    	window_top = parseInt($(window).scrollTop())+200;

    	

    	$('#PostGalleryContainer').show();

    	$('#PhotoGalleryWindow').show();

    	$('#PostGallery').css({top: window_top});

    	$('#PostGallery').animate({width: window_w}, 500);

    	$('#PhotoGalleryThumbnails').delay(500).slideDown(600);

    }

    

    function activate_video(linkaddress, imgsrc) {

    	

		flowplayer("a.player_popup", {src: stylesheet_directory+"/js/flowplayer/flowplayer-3.2.5.swf", wmode: 'opaque'},  {

			playlist: [

			// this first PNG clip works as a splash image

			{

				scaling: 'orig'

			},

		

			// second clip is a video. when autoPlay is set to false the splash screen will be shown

			{

				url: linkaddress, 

				autoPlay: true, 

			

			// video will be buffered when splash screen is visible

				autoBuffering: true 

			}

			]

			});    	

    	

    }

    

    function allEffects() {

    	

    	

    $("#PostGalleryContainer").click(function() {

    

  	$('#PostGalleryContainer').hide();

  	$('#PhotoGalleryWindow').hide();   

  	$('#PhotoGalleryThumbnails').slideUp(100);	

  	$('#PhotoGalleryWindow').html('');

  	

	});	

	

$("#CloseButton").click(function() {

    

  	$('#PostGalleryContainer').hide();

  	$('#PhotoGalleryWindow').hide();   

  	$('#PhotoGalleryThumbnails').slideUp(100);	

  	$('#PostGallery > .video-js-box > .video-js').children().hide();	

  	$('#PhotoGalleryWindow').html('');

  	return false;

	});		

	

	

	

	



	

	

	

	

	

	$("span.textaccordion").animate({height: 'toggle'}, { "duration": 0});

	

	$("span.contentaccordion > span.titleaccordion").click(function() {

    

  	$(this).parent().children(".textaccordion").animate({height: 'toggle'}, { "duration": 300});

  	$(this).toggleClass('clicked')

  	

	});	

	

	

	

	



	

	

	

	}



//other starts here



function dd_menu() {

			

			

			$("#MenuBg").mouseover(function() {

				//$("span.sub-menu-container").css({display: 'none'});

			});

			

			$("ul.menu > li > a").mouseover(function() {

				if ($(this).parent().children(".sub-menu-container").css("display") == 'none') {

					$("span.sub-menu-container").css({display: 'none'});

					$(this).parent().children(".sub-menu-container").fadeIn(300);

				}

				

			});

			

			$("ul.menu > li > a").mouseout(function() {

				

				$("span.sub-menu-container").mouseover(function() {

					$(this).css({display: 'block'});

				});

				

				$("#Header").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});

				

				$("#HomepagePromo").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});			

				

				$("#Content").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});						



				$("#Content").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});									

				

				$(".SubMenu").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});					

				

				$("#BreadCrumbsBar").mouseover(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});						

				

				$("ul.menu > li > a").mouseleave(function() {

					$("span.sub-menu-container").css({display: 'none'});

				});	

				

			});	

		

		

			if(document.getElementById(default_element+'HList'+default_id)) {

				$("#"+default_element+"HList"+default_id).show(0);

				$("#"+default_element+"Butt"+default_id).addClass('HomeArticlesButton_sel');

			}

			

			

			

			$("span.HomeArticlesButton").mouseover(function() {

				

				$(this).addClass('HomeArticlesButton_on');

				

			});

			

			$("span.HomeArticlesButton").mouseout(function() {

				

				$(this).removeClass('HomeArticlesButton_on');

				

			});

			

			$("span.HomeArticlesButton").click(function() {

				

				$("span.HomeArticlesButton").removeClass('HomeArticlesButton_sel');

				$(this).addClass('HomeArticlesButton_sel');

				

			});			

			

			

			

			$("input").mouseover(function() {

				

				$(this).addClass('over');

				

			});



			$("select").mouseover(function() {

				

				$(this).addClass('over');

				

			});			

			

			$("textarea").mouseover(function() {

				

				$(this).addClass('over');

				

			});						

			

			$("input").mouseout(function() {

				

				$(this).removeClass('over');

				

			});			

			

			$("select").mouseout(function() {

				

				$(this).removeClass('over');

				

			});		

			

			$("textarea").mouseout(function() {

				

				$(this).removeClass('over');

				

			});								

			

			

			

		$('.firstslide').each(function(index) {



			$(this).parent().css("height", $(this).height());

		});

			

		$("span.slide_butt").mouseover(function() {

			$(this).addClass('slide_butt_on');

		});

			

		$("span.slide_butt").mouseout(function() {

			$(this).removeClass('slide_butt_on');

		});		

			

			

		

		

		$('.InfoIcon').mouseover(function() {

			$(this).children().clearQueue();

			$(this).children().fadeIn(0);

			objHeight = 0-parseInt($(this).children().css("height"))-30;

			$(this).children().fadeOut(0);

			objLeft = 0-20;

			$(this).children().css({marginTop:objHeight, marginLeft: objLeft});

			$(this).children().fadeIn(200);



			

		});

		

		$('.InfoIcon').mouseout(function() {

			$(this).children().clearQueue();

			$(this).children().fadeOut(0);

		});		

		



		

   

		$('span.tabsTab').mouseover(function () {

			$(this).addClass('over');						

		});

		

		$('span.tabsTab').mouseout(function () {

			$(this).removeClass('over');						

		});

		

		$('span.tabsTab').click(function () {

			

			$('span.tabsTab').each(function(index) {

				$(this).removeClass('selected');

			});			

		

			$(this).addClass('selected');

			

		});		

		

		$(".contentTabs").each(function(index) {

			$(this).children("div:first").css({display: "block"});

			

		});



		

		}

		

		



		function switchContentTabs(obj) {

			

			$('div.tabText').each(function(index) {

				$(this).slideUp(300);

			});			

			

			$("#tabtext_"+obj).delay(400).slideDown(300);

			

		}

		

		function slide(sp, nr, obj) {

			

			

		

			for(k = 1 ; k <= nr ; k++) {

				j = k-1;

				spj = sp-1;

				spi = parseInt($('#'+obj+'slideb'+k+'_slide').css("width"));

				

				spa = j*(spi+21)-spj*(spi+21);

				

				newslideheight = $('#'+obj+'slideb'+sp+'_slide').height();

				

				

				if (k == sp) {

					$('#'+obj+'slideb'+k).addClass('slide_butt_sel');

					

					$('#'+obj+'slideb'+k+'_slide').show(0).animate({ marginLeft: spa }, 500).addClass("selected_slide");

					

				}

				else {

					$('#'+obj+'slideb'+k).removeClass('slide_butt_sel');

					$('#'+obj+'slideb'+k+'_slide').removeClass("selected_slide");

					$('#'+obj+'slideb'+k+'_slide').animate({ marginLeft: spa }, 500).hide(0);

				}

				

				$('#'+obj).animate({height: newslideheight}, 200);

				

			}

			

		

			

		}

		
		
		function showmiddle(obj)
		{  
		   $(".HomepageList").show(0);

			

			$("#"+obj).fadeIn(300);
				
		}
	
	

		function showHomeArticles(obj) {

			

			$(".HomepageList").hide(0);

			

			$("#"+obj).fadeIn(300);

			

		}



			function setActiveStyleSheet(title) {

	

  var i, a, main;

  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {

      a.disabled = true;

      if(title != a.title) {

      //document.getElementById(a.title).className = a.title;

    }

      if(a.getAttribute("title") == title) a.disabled = false;

    }

  }



}

		

    




















