// JavaScript Document
/*for index.html accordion*/
current=1;
function show_div(id){
	if(current!=id)
	{
		$('#wts-new-hdp'+current).show();
		$('#wts-new-hdp'+id).hide();
										
		$('#wts-new-hdm'+current).hide();
		$('#wts-new-hdm'+id).show();
		
		$('#wts-new-content'+current).hide();
		$('#wts-new-content'+id).show(400);
		
		current=id;
	}
}
function hide_div(id){
	if(current!=id)
	{
		$('#wts-new-hdm'+current).show();
		$('#wts-new-hdm'+id).hide();
										
		$('#wts-new-hdp'+current).hide();
		$('#wts-new-hdp'+id).show();
		
		$('#wts-new-content'+id).hide();
		$('#wts-new-content'+current).show(400);
		
		current=id;
	}
}
/*accordion ends here*/

/*index.html Expandible Banner*/
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}
/*index.html Expandible Banner End*/

/*for index.html website screenshot slideshow */
var curImg = 0;
var imgs = ['website-srcn-shot-img1', 'website-srcn-shot-img2', 'website-srcn-shot-img3', 'website-srcn-shot-img4', 'website-srcn-shot-img5'];
var caption = ['CRY Overseas ', 'CRY Buddies', 'CRY for Girls', '5Cs', 'Marathon'];
function next()
{
  	document.getElementById(imgs[curImg]).style.display = "none";
  	curImg++;
  	if(curImg == imgs.length)
    curImg = 0;
  	var div=document.getElementById(imgs[curImg]);
	$(div).fadeIn('slow');
	
	document.getElementById("caption").innerHTML=caption[curImg];
};
function prev()
{
  	document.getElementById(imgs[curImg]).style.display = "none";
  	curImg--;
  	if(curImg == -1)
    curImg = imgs.length-1;
  	var div=document.getElementById(imgs[curImg]);
	$(div).fadeIn('slow');
	document.getElementById("caption").innerHTML=caption[curImg];
}; 

/*website screenshot slideshow ends here*/


/* bookmark a page */
function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}



/*for stories-of-hope accordion*/

curStory=1;
function show_story(id){
	if(curStory!=id)
	{
		$('#stories-hope-accordion-content'+curStory).hide();
		$('#stories-hope-accordion-content'+id).show(400);
		
		document.getElementById('plus'+curStory).src='resources/images/plus.gif';
		document.getElementById('plus'+id).src='resources/images/minus.gif';
		
		document.getElementById('stories-hope-accordion-hd'+curStory).style.border='#E7E7E7 1px solid';
		document.getElementById('stories-hope-accordion-hd'+id).style.border='#ffd000 1px solid';
		
		curStory=id;
	}
}


function show_title(id){
	$('#issue'+id).hide();
	$('#stories-hope-accordion-title'+id).show();
}
function show_issue(id){
	$('#stories-hope-accordion-title'+id).hide()
	$('#issue'+id).show()
}

/*$(document).ready(function(){					   
    $("#stories-hope-accordion-hd1").bind("mouseenter",function(){
    	$('#issue1').hide();
	  	$('#stories-hope-accordion-title1').show();
    }).bind("mouseleave",function(){
      	$('#stories-hope-accordion-title1').hide()
		$('#issue1').show()
    });
});*/


/*for contact-us pop-up image*/
function popImage(imgname){
	var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
	disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25";
	var content_vlue = "<img src='" + imgname + "' border=0>";
	var docprint ;
	docprint = window.open("","",disp_setting);
	docprint.document.open();
	docprint.document.write('<html><head><title>CRY</title>');
	docprint.document.write('<LINK href=style/cryprint.css rel=STYLESHEET type=text/css>');
	docprint.document.write('</head><body >');
	docprint.document.write('</head><body>');
	docprint.document.write(content_vlue);
	docprint.document.write('</body></html>');
	docprint.document.close();
	docprint.focus();
}


/*change font size*/
var strFontSize;
strFontSize = "S"; 
function changeFontSize(){
	if (strFontSize == "S")
	{
		$('.who-we-are-content').css('font-size', 14);
		$('.h_txt').css('font-size', 14);
		$('.s_links p').css('font-size', 14);
		$('.user-appl-content').css('font-size', 14);
		strFontSize = "L"
	}
	else
	{
		$('.who-we-are-content').css('font-size', 11);
		$('.h_txt').css('font-size', 11);
		$('.s_links p').css('font-size', 11);
		$('.user-appl-content').css('font-size', 11);
		strFontSize = "S"
	}
} 



/*for project.html*/

/*$(document).ready(function(){
						   
	var timeout	= 500;
	var closetimer	= 0;
	var ddmenuitem	= 0;
	
	$("#state1").mouseover(function(){
		if($('#project-list1').is(':hidden')== false)	
			$('#project-list1').hide();		
		$('#project-list1').show();
	});
		
	$("#state1").mouseout(function() {
		if($('#project-list1').is(':hidden')== false)	
			$('#project-list1').hide();		
		closetimer = window.setTimeout($('.product-list').hide(), 500);
	});
	
	$("#project-list1").mouseover(function(){
		if($('#project-list1').is(':hidden')== false)	
			$('#project-list1').hide();		
		$('#project-list1').show();
	});
		
	$("#project-list1").mouseout(function() {
		if($('#project-list1').is(':hidden')== false)	
			$('#project-list1').hide();		
		closetimer = window.setTimeout($('.product-list').hide(), 500);
	});

	$('#state1').bind('mouseover', function(e) {
		var pos = $(e.target);
		if(pos.parents().is('#project-list1') == false || pos.parents().is('#state1') == false ) {
			$('#project-list1').show();
		} 
	});
	$('#state1').bind('mouseout', function(e) {
		var pos = $(e.target);
		if(pos.parents().is('#project-list1') == false || pos.parents().is('#state1') == false  ) {
			$('#project-list1').hide();
		} 
	});

});*/

function show_project(id){
	$('#project-list'+id).show();
}
function hide_project(id)
{$('#project-list'+id).hide();
}

	function selLink(num)
	{
		var objName = '';
		if (num == 0)
		{$('#rt-menu').hide();}
		else
		{
			objName = num + '';
			if (num > 10)
			{
				document.getElementById(objName).className = "selSub";	
				num = parseInt(num / 10);
				objName = num + 's';
				$('#' + objName).show();
			}
			else
			{
				document.getElementById(objName).className = "sel";	
				try
				{
					objName = objName + 's'
					$('#' + objName).show();
				}
				catch (e)
				{}
			}
		}
	}
