// JavaScript Document
$(document).ready(function(){
	//hiding elements
	$('.flyout, .flyoutC, .submenu').hide();
	//menu
	function mouseOver(elem) {
			$('.submenu, .flyout, .flyoutC', this).slideDown();
	}
	function mouseOut(elem) {
		$('.submenu, .flyout, .flyoutC', this).slideUp();	
	}
	
	$('#accordion > ul > li').hoverIntent(mouseOver, mouseOut);
	
	$(".blogTitle").click(function() {
		window.location='http://www.bedistinguished.blogspot.com/';
	});
	
	$(".eventsTitle").click(function() {
		window.location='http://www.distinguishedyw.org/news/calendar_of_events/';
	});
	
	$(".newsTitle").click(function() {
		window.location='/news/';
	});
	
	if ($(".flyout").has("li").length){
  				
	}else {
		$("<li><a>No Local Programs</a></li>").appendTo(".flyout");	
	}
	
	/*$("#right .c1").click(function() {
		window.open('http://www.getnside.com/cc/magazine/medical/102009/profiles/1489-Dr_Richard_Ingraham/', '_blank');
	});*/
	
	var transition = 'fade'; //type of transition you want
	var speed = 'slow'; //this is the speed of the animation effect
	var timeout = 5000; //this is the speed between slides
		
	$.ajax({
        type: "GET",
	url: "/include_2/website/templates/televox/flash/image.xml",
	dataType: ($.browser.msie) ? "text" : "xml",
	success: function(data) { 
		var xml;
		 // look at me, im IE, I can do things however the @#%$ I want
            if (typeof data == "string") {
                xml = new ActiveXObject("Microsoft.XMLDOM");
                xml.async = false;
                xml.loadXML(data);
            } else {
                // Hi we're the other browsers, by the way, we hate IE
                xml = data;
            }
		//getting thumbs
		$(xml).find('thumbs').each(function(){
			$(this).find('path').each(function(){
			var path = $(this).text();							
			$('<div class="thumb"></div>').html('<ul><li><a href="#"><img src="'+path+'"/></a></li></ul>').appendTo('#thumbs');
			});
		});//end loop
		var i = 1;
		$('.thumb').each(function() {
			$(this).attr('id', 'thumb'+i++);
		});		
		//getting slides and description
		$(xml).find('slide').each(function(){
			var image = $(this).find('image').text();
			var title = $(this).find('title').text();
			var description = $(this).find('description').text();
			$('<div class="slide"></div>').html('<img src="'+image+'"/><p class="ssTitle">'+title+'</p><p class="ssDesc">'+description+'</p>').appendTo('#slideshow');			
		});//end loop
		//assign numeric id to each slide
		var i = 1;
		$('.slide').each(function() {
			$(this).attr('id', 'slide'+i++);
		});
		
		$('#slideshow').cycle({ 
			fx:     transition, 
			speed:  speed, 			
			timeout: timeout,
			pager:  '.thumb',
			pagerAnchorBuilder: function(idx, slide) { 
        		return '.thumb li:eq(' + (idx) + ') a'; 
    		} 				
		});
		
		
		
		}		
	});//end xml function			
});//end document ready

// Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use

//Enter domain of site to search.
var domainroot="www.distinguishedyw.org"

function Gsitesearch(curobj){
curobj.q.value="site:"+domainroot+" "+curobj.qfront.value
}

/*sifr */
function pageScripts(){
/*callout SIFR*/
var Glypha = {  src: '/include_2/website/templates/televox/flash/Glypha.swf' };
sIFR.activate(Glypha);
sIFR.replace(Glypha, {
  selector: '#callouts h2', 
  wmode: 'transparent', 
  src:  '/include_2/website/templates/televox/flash/Glypha.swf', 
  css: [ '.sIFR-root {font-size:20px;color:#ffffff; font-weight:bold;cursor:pointer;}'  ]
});

/*national sponsor SIFR*/
var Glypha = {  src: '/include_2/website/templates/televox/flash/Glypha.swf' };
sIFR.activate(Glypha);
sIFR.replace(Glypha, {
  selector: '#sponsors h2', 
  wmode: 'transparent', 
  src:  '/include_2/website/templates/televox/flash/Glypha.swf', 
  css: [ '.sIFR-root {font-size:20px;color:#000000;font-weight:bold;}'  ]
});

}



