$(document).ready(function () {
    $('#sbUpGoBtn').hover(function(){$(this).attr('src','img/general/sb-btn-overlay.jpg');},function(){$(this).attr('src','img/general/sb-btn.jpg');});
    $('#sbBottomGoBtn').hover(function(){$(this).attr('src','img/general/sb-btn-overlay.jpg');},function(){$(this).attr('src','img/general/sb-btn.jpg');});
    $('#ssGoBtn').hover(function(){$(this).attr('src','img/general/sb-btn-overlay.jpg');},function(){$(this).attr('src','img/general/sb-btn.jpg');});    
    $('#sBottomGoBtn').hover(function(){$(this).attr('src','img/general/sb-btn-overlay.jpg');},function(){$(this).attr('src','img/general/sb-btn.jpg');});        


	$('#ssGoBtn').css("cursor","pointer");
	$('#sBottomGoBtn').css("cursor","pointer");


	$('#healthCenters').mouseover(function(){
		$('#vmIl').hide();
        $('#vmL').hide();
		$('#vmHc').show();
		$('#vmHcBcg').slideDown();
		$('#vmHcBorder').slideDown();
		$('#vmHcMother').show("500");	
		$('#vmHcOver').show();
		$('#left-col-sb').css('z-index','-1');
        $('#vmHcMother p a:first').click();
	});
	$('#vmHcMother').find("p").find("a").css("cursor","pointer");
	$('#vmHcMother').find("p").find("a").click(function(){
		$('#vmHcBorder').hide();
		$('#vmHcStretch').hide();		
		$('#vmHcStretch').show();
        $('#vmHcStretch2').hide();		
		$('#vmHcStretch2').show();
		$('#vmHcBorder').show();
		$('#vmHcChild').show();
        $('.vmColumn').show();
	});
	$('#vmHcOver').mouseover(function(){
		$('#vmHc').hide();
		$('#vmHcBcg').hide();
		$('#vmHcBorder').hide();
		$('#vmHcMother').hide();		
		$('#vmHcStretch').hide();
        $('#vmHcStretch2').hide();
		$('#vmHcBorder').hide();
		$('#vmHcChild').hide();
		$('#vmHcOver').hide();
        $('.vmColumn').hide();
		$('#left-col-sb').css('z-index','');
	});

	$('#interactivesLibrary').mouseover(function(){
        $('#vmL').hide();
		$('#vmHc').hide();
		$('#vmIl').show();
		$('#vmIlBcg').slideDown();
		$('#vmIlBorder').slideDown();
		$('#vmIlMother').show("500");	
		$('#vmIlOver').show();
        $('#vmIlMother p a:first').click();
	});
	$('#vmIlMother').find("p").find("a").css("cursor","pointer");
	$('#vmIlMother').find("p").find("a").click(function(){
		$('#vmIlBorder').hide();
		$('#vmIlStretch').hide();		
		$('#vmIlStretch').show();
        $('#vmIlStretch2').show();
		$('#vmIlBorder').show();
		$('#vmIlChild').show();
        $('.vmColumn').show();
	});
	$('#vmIlOver').mouseover(function(){
		$('#vmIl').hide();
		$('#vmIlBcg').hide();
		$('#vmIlBorder').hide();
		$('#vmIlMother').hide();		
		$('#vmIlStretch').hide();
        $('#vmIlStretch2').hide();
		$('#vmIlBorder').hide();
		$('#vmIlChild').hide();
		$('#vmIlOver').hide();
        $('.vmColumn').show(); 
	});
	
    $('#breadcrumb')
			.before('<div id="vmL" class="vmContainer"><div id="vmLBcg"><div id="vmMother" class="vmColumn" style="border:0 none !important"><p><a href="/licensing_images?lict_g=web">Images (Web Only)</a></p><p><a href="/licensing_images?lict_g=press">Images (Print and Web)</a></p><p><a href="/licensing_videos">Videos</a></p><p><a href="/licensing_interactives">Interactives</a></p></div></div><div id="vmLBorder" class="vmBorder"><img width="1" height="280" alt="" class="IEFixSB" src="img/general/vmStretchBorder.png"></div></div><div id="vmLOver"></div>')

    
    $('#licensing').mouseover(function(){
        $('#vmL').show();
		$('#vmHc').hide();
		$('#vmIl').hide();
		$('#vmLBcg').slideDown();
		$('#vmLBorder').slideDown();
		//$('#vmIlMother').show("500");	
		$('#vmLOver').show();        
    })
    $('#vmLOver').mouseover(function(){
        $('#vmL').hide();
    })

	
	$('#vmCatMother').find("p").css("cursor","pointer");
	$('#vmFooterVnMother').find("p").css("cursor","pointer");
	$('#vmHcFooterMother').find("p").css("cursor","pointer");
		
		
});



function loadhc(id,from){
	var i=0;
    var pager=14;
    //if (hcc!=358)$('#vmHcMother p a:first').css('color','#000000');
	 $('#vmHcChild').empty();
	 $('#vmHcChild').append('<div id="loading"><img src="img/loader.gif"> Loading</div>');
     $('#vmHcMother p a').css('color','#000000');
     $('#hcl'+id).css('color','#CC0000');
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_selected.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $('#vmHcChild').empty();
                 	$(xml).find('item').each(function(){
                 		$('#loading').remove();
						if (i<from+pager && i>=from){
							$('#vmHcChild').append('<p><a href="'+$(this).attr('href')+'" onmouseover="loadhcr('+$(this).attr('id')+')">'+$(this).attr('title')+' '+'('+$(this).attr('num')+')</a></p>')
							
						}
						i++;
                 		});
                    $(xml).find('right').each(function(){
                 		$('#vmHcStretch2 #vmHcChild').empty().append('<p><a href="'+$(this).attr('href')+'"><strong>'+$(this).attr('title')+'</strong><br><br><img src="'+$(this).attr('image')+'" style="padding-bottom:2px"></a><br>'+$(this).attr('desc')+'...</p>');
                 		});    
                        
                 		var num=$(xml).find('menu').attr('count');
						if (from>0){
							$('#vmHcChild').prepend('<div class="vmBtn" id="vmCatChildPrevBtn"><a onclick="loadhc('+id+','+(from-pager)+')"><img src="img/general/vm_prev_btn.png" width="30" height="15" /></a></div>');
							$('#vmHcChild #vmCatChildPrevBtn').css('display','block');
							$('#vmHcChild #vmCatChildPrevBtn').css('cursor','pointer');
                 		}
                 		if (from+pager<num){
							$('#vmHcChild').append('<div class="vmBtn" id="vmCatChildNextBtn"><a onclick="loadhc('+id+','+(from+pager)+')"><img src="img/general/vm_next_btn.png" width="30" height="15" /></a></div>');
							$('#vmHcChild #vmCatChildNextBtn').css('display','block');
							$('#vmHcChild #vmCatChildNextBtn').css('cursor','pointer');
						}
                }
            });
}
function loadhcr(id){
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_selected.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $(xml).find('right').each(function(){
                 		$('#vmHcStretch2 #vmHcChild').empty().append('<p><a href="'+$(this).attr('href')+'"><strong>'+$(this).attr('title')+'</strong><br><br><img src="'+$(this).attr('image')+'" style="padding-bottom:2px"></a><br>'+$(this).attr('desc')+'...</p>');
                 		});    
                }
            });
    
}
function loadhc2(id,from){
	var i=0;
	 $('#vmCatChild').empty();
	 $('#vmCatChild').append('<div id="loading"><img src="img/loader.gif"> Loading</div>');
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_selected.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $('#vmCatChild').empty();
                 	$(xml).find('item').each(function(){
                 		$('#loading').remove();
						if (i<from+8 && i>=from){
							$('#vmCatChild').append('<p><a href="'+$(this).attr('href')+'">'+$(this).attr('title')+' '+'('+$(this).attr('num')+')</a></p>')
							
						}
						i++;
                 		});
                 		var num=$(xml).find('menu').attr('count');
						if (from>0){
							$('#vmCatChild').prepend('<div class="vmBtn" id="vmCatChildPrevBtn"><a onclick="loadhc2('+id+','+(from-8)+')"><img src="img/general/vm_prev_btn.png" width="30" height="15" /></a></div>');
							$('#vmCatChild #vmCatChildPrevBtn').css('display','block');
							$('#vmCatChild #vmCatChildPrevBtn').css('cursor','pointer');
                 		}
                 		if (from+8<num){
							$('#vmCatChild').append('<div class="vmBtn" id="vmCatChildNextBtn"><a onclick="loadhc2('+id+','+(from+8)+')"><img src="img/general/vm_next_btn.png" width="30" height="15" /></a></div>');
							$('#vmCatChild #vmCatChildNextBtn').css('display','block');
							$('#vmCatChild #vmCatChildNextBtn').css('cursor','pointer');
							
						}
                }
            });
}
function loadhc3(id,from){
	var i=0;
	 $('#vmFooterVnChild').empty();
//	 $('#vmFooterVnChild').append('<div id="loading"><img src="img/loader.gif"> Loading</div>');
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_selected.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $('#vmFooterVnChild').empty();
                 	$(xml).find('item').each(function(){
//                 		$('#loading').remove();
						if (i<from+8 && i>=from){
							$('#vmFooterVnChild').append('<p><a href="'+$(this).attr('href')+'">'+$(this).attr('title')+' '+'('+$(this).attr('num')+')</a></p>')
							
						}
						i++;
                 		});
                 		var num=$(xml).find('menu').attr('count');
						if (from>0){
							$('#vmFooterVnChild').prepend('<div class="vmBtn" id="vmCatChildPrevBtn"><a onclick="loadhc3('+id+','+(from-8)+')"><img src="img/general/vm_prev_btn.png" width="30" height="15" /></a></div>');
							$('#vmFooterVnChild #vmCatChildPrevBtn').css('display','block');
							$('#vmFooterVnChild #vmCatChildPrevBtn').css('cursor','pointer');
                 		}
                 		if (from+8<num){
							$('#vmFooterVnChild').append('<div class="vmBtn" id="vmCatChildNextBtn"><a onclick="loadhc3('+id+','+(from+8)+')"><img src="img/general/vm_next_btn.png" width="30" height="15" /></a></div>');
							$('#vmFooterVnChild #vmCatChildNextBtn').css('display','block');
							$('#vmFooterVnChild #vmCatChildNextBtn').css('cursor','pointer');							
						}
                }
            });	
}

function loadil(id,from){
//	$('#vmIlChild').load("dir/dir_il_text.php?idc="+id);
	var i=0;
    //if (id!=1120)$('#vmIlMother p a:first').css('color','#000000');
    $('#vmIlMother p a').css('color','#000000');
    $('#ill'+id).css('color','#CC0000');
	 $('#vmIlChild').empty();
	 $('#vmIlChild').append('<div id="loading"><img src="img/loader.gif"> Loading</div>');
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_il_text.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $('#vmIlChild').empty();
                 	$(xml).find('item').each(function(){
                 		$('#loading').remove();
						if (i<from+8 && i>=from){
							$('#vmIlChild').append('<p><a href="'+$(this).attr('href')+'" onmouseover="loadilr('+$(this).attr('id')+')">'+$(this).attr('title')+' '+(($(this).attr('num')>0)?'('+$(this).attr('num')+')':'')+'</a></p>')
						}
						i++;
                 		});
	                   $(xml).find('right').each(function(){
                 		$('#vmIlStretch2 #vmIlChild').empty().append('<p><a href="'+$(this).attr('href')+'"><strong>'+$(this).attr('title')+'</strong></a><br><br><img src="'+$(this).attr('image')+'"><br>'+$(this).attr('desc')+'</p>');
                 		});                        
                 		var num=$(xml).find('menu').attr('count');
						if (from>0){
							$('#vmIlChild').prepend('<div class="vmBtn" id="vmCatChildPrevBtn"><a onclick="loadil('+id+','+(from-8)+')"><img src="img/general/vm_prev_btn.png" width="30" height="15" /></a></div>');
							$('#vmIlChild #vmCatChildPrevBtn').css('display','block');
							$('#vmIlChild #vmCatChildPrevBtn').css('cursor','pointer');
                 		}
                 		if (from+8<num){
							$('#vmIlChild').append('<div class="vmBtn" id="vmCatChildNextBtn"><a onclick="loadil('+id+','+(from+8)+')"><img src="img/general/vm_next_btn.png" width="30" height="15" /></a></div>');
							$('#vmIlChild #vmCatChildNextBtn').css('display','block');
							$('#vmIlChild #vmCatChildNextBtn').css('cursor','pointer');							
						}
                }
            });		
}
function loadilr(id){
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_il_text.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
	                   $(xml).find('right').each(function(){
                 		$('#vmIlStretch2 #vmIlChild').empty().append('<p><a href="'+$(this).attr('href')+'"><strong>'+$(this).attr('title')+'</strong></a><br><br><img src="'+$(this).attr('image')+'"><br>'+$(this).attr('desc')+'</p>');
                 		});                        
                }
            });    
}
function loadil2(id,from){
//	$('#vmFooterHcChild').load("dir/dir_il_text.php?idc="+id);
	var i=0;
	 $('#vmFooterHcChild').empty();
//	 $('#vmFooterHcChild').append('<div id="loading"><img src="img/loader.gif"> Loading</div>');
	 $.ajax({
                 type: "GET",
                 url: "dir/dir_il_text.php?idc="+id,
                 dataType: "xml",
                 success: function(xml) {
                    $('#vmFooterHcChild').empty();
                 	$(xml).find('item').each(function(){
//                 		$('#loading').remove();
						if (i<from+8 && i>=from){
							$('#vmFooterHcChild').append('<p><a href="'+$(this).attr('href')+'">'+$(this).attr('title')+' '+(($(this).attr('num')>'0')?'('+$(this).attr('num')+')':'')+'</a></p>')
							
						}
						i++;
                 		});
                 		var num=$(xml).find('menu').attr('count');
						if (from>0){
							$('#vmFooterHcChild').prepend('<div class="vmBtn" id="vmCatChildPrevBtn"><a onclick="loadil('+id+','+(from-8)+')"><img src="img/general/vm_prev_btn.png" width="30" height="15" /></a></div>');
							$('#vmFooterHcChild #vmCatChildPrevBtn').css('display','block');
							$('#vmFooterHcChild #vmCatChildPrevBtn').css('cursor','pointer');
                 		}
                 		if (from+8<num){
							$('#vmFooterHcChild').append('<div class="vmBtn" id="vmCatChildNextBtn"><a onclick="loadil('+id+','+(from+8)+')"><img src="img/general/vm_next_btn.png" width="30" height="15" /></a></div>');
							$('#vmFooterHcChild #vmCatChildNextBtn').css('display','block');
							$('#vmFooterHcChild #vmCatChildNextBtn').css('cursor','pointer');
							
						}
                }
            });	
}
