//Function to findout the browser. 
//Input: -
//Returns: browser name
function getBrowser(){
	var browser;
	if(navigator.appName.indexOf("Internet Explorer") != -1)
	{
		temp=navigator.appVersion.split("MSIE");
		browser='IE'+parseFloat(temp[1]);
	}
	else if(navigator.appName.indexOf("Netscape") != -1)
	{
		temp=navigator.userAgent.split("Firefox/");
		browser='FF'+parseFloat(temp[1]);
	}
	return browser;
}

//Function to set dimension of "Home" page.
function setKBHomeDimension(){
	krunchHomeParent=document.getElementById('krunch_home_parent');
	homeContentsBlock=document.getElementById('home_contents_block');
	khBanner=document.getElementById('kh_banner');
	menuPanelParent=document.getElementById('menu_panel_parent');
	flashParent=document.getElementById('flash_parent');
	khCopyrightParent=document.getElementById('kh_copyright_parent');
	aboutKbBlock=document.getElementById('about_kb_block');
	kbTourBlock=document.getElementById('kb_tour_block');
	aboutKbCoreBlock=document.getElementById('about_kb_core_block');
	faqBlock=document.getElementById('faq_block');
	faqBody=document.getElementById('faq_body');
	leftColumn=document.getElementById('left_column');
	rightColumn=document.getElementById('right_column');
	testimonialsBlock=document.getElementById('testimonials_block');
	testimonialsBody=document.getElementById('testimonials_body');
	
	browser=getBrowser();
	
	pageHeight=krunchHomeParent.offsetHeight;
	if(browser=="IE6"){
		homeContentsBlock.style.height="auto";
		aboutKbBlock.style.width=eval(homeContentsBlock.offsetWidth*0.7-10)+"px";
		kbTourBlock.style.width=eval(homeContentsBlock.offsetWidth*0.7-10)+"px";
	}else{
		homeContentsBlock.style.height="auto";
		aboutKbBlock.style.width=eval(homeContentsBlock.offsetWidth*0.7-20)+"px";
		kbTourBlock.style.width=eval(homeContentsBlock.offsetWidth*0.7-20)+"px";
	}
//	aboutKbCoreBlock.style.height=eval(aboutKbBlock.offsetHeight-40)+"px";
	
	faqBlock.style.width=eval(homeContentsBlock.offsetWidth*0.3-50)+"px";
//	faqBody.style.height=eval(faqBlock.offsetHeight-32)+"px";
	testimonialsBlock.style.width=eval(homeContentsBlock.offsetWidth*0.3-50)+"px";
//	testimonialsBody.style.height=eval(testimonialsBlock.offsetHeight-32)+"px";
}

//Function for Menu navigation. Highlights the menu which has been selected.
function showSelectedMenuLogin(p,sm){
	var parentObj=document.getElementById(p);
	var selectedMenuObj=document.getElementById(sm);
	var childDivs=parentObj.getElementsByTagName('div');

	for(i=1;i<childDivs.length-1;i++){
		if(childDivs[i].className=='selected_menu_bg'){
			childDivs[i].className='unselected_menu_bg';
		}
	}
	selectedMenuObj.className='selected_menu_bg';
	if(childDivs[1].className=='selected_menu_bg'){
		childDivs[0].className='selected_menu_left';
	}else{
		childDivs[0].className='unselected_menu_left';
	}
	if(childDivs[childDivs.length-2].className=='selected_menu_bg'){
		childDivs[childDivs.length-1].className='selected_menu_right';
	}else{
		childDivs[childDivs.length-1].className='unselected_menu_right';
	}
}

//Function to set the dimension of "home_why_krunchbox" page. Used by both "home_why_krunchbox" and "home_why_krunchbox2" pages.
function setKBHomeWhyKBDimension(){
	krunchHomeParent=document.getElementById('krunch_home_parent');
	homeContentsBlock=document.getElementById('kb_home_contents_block');
	khBanner=document.getElementById('kh_banner');
	menuPanelParent=document.getElementById('menu_panel_parent');
	flashParent=document.getElementById('flash_parent');
	khCopyrightParent=document.getElementById('kh_copyright_parent');
	leftMenuBlock=document.getElementById('left_menu_block');
	rightConntentsBlock=document.getElementById('right_conntents_block');
	
	browser=getBrowser();
	
	pageHeight=krunchHomeParent.offsetHeight;
	homeContentsBlock.style.height=eval(pageHeight-khBanner.offsetHeight-menuPanelParent.offsetHeight-flashParent.offsetHeight-80)+"px";
	rightConntentsBlock.style.width=eval(homeContentsBlock.offsetWidth-leftMenuBlock.offsetWidth-25)+"px";
}
function setKBHomeNewDimension(){
	krunchHomeParent=document.getElementById('krunch_home_parent');
	homeContentsBlock=document.getElementById('home_contents_block');
	khBanner=document.getElementById('kh_banner');
	menuPanelParent=document.getElementById('menu_panel_parent');
	flashParent=document.getElementById('flash_parent');
	khCopyrightParent=document.getElementById('kh_copyright_parent');
	aboutKbBlock=document.getElementById('about_kb_block');
	kbTourBlock=document.getElementById('kb_tour_block');
	aboutKbCoreBlock=document.getElementById('about_kb_core_block');
	faqBlock=document.getElementById('faq_block');
	faqBody=document.getElementById('faq_body');
	leftColumn=document.getElementById('left_column');
	rightColumn=document.getElementById('right_column');
	testimonialsBlock=document.getElementById('testimonials_block');
	testimonialsBody=document.getElementById('testimonials_body');
}

function getOverviewDimension(){
	rightBlock=document.getElementById('right_block');
	khBanner=document.getElementById('kh_banner');
	
	rightBlock.style.width=eval(khBanner.offsetWidth-220)+"px";
//	alert(document.getElementById('kh_banner').offsetWidth);
}

var menuObj;

function setClickedMenu(menu){
	menuObj=document.getElementById(menu);
}

function getClickedMenu(){
	return menuObj;
}
function highlightFAQMenu(menu){
	menuObj=document.getElementById(menu);
	contentParent=document.getElementById('content');
	contents=contentParent.getElementsByTagName('div');
	for(i=0;i<contents.length;i++){
		contents[i].className='faq_menu_unselected';
	}
	menuObj.className='faq_menu_selected';
	activeMenu=getClickedMenu();
	activeMenu.className='faq_menu_selected';
}

function disableFAQMenu(menu){
	menuObj=document.getElementById(menu);
	contentParent=document.getElementById('content');
	contents=contentParent.getElementsByTagName('div');
	for(i=0;i<contents.length;i++){
		contents[i].className='faq_menu_unselected';
	}
	menuObj.className='faq_menu_unselected';
	activeMenu=getClickedMenu();
	activeMenu.className='faq_menu_selected';
}


function hide_details(){
	a=hide_details.arguments;
	for(i=0; i<a.length; i++)
	{
	    if(document.getElementById(''+a[i]) != null)
	    {
	        document.getElementById(''+a[i]).style.display="none";
	    }
	}
}
function show_details(){
	a=show_details.arguments; 
	for(i=0; i<a.length; i++)
	{
	if(document.getElementById(""+a[i]) != null)
	    {
   	    	document.getElementById(""+a[i]).style.display="block";
    	}
   }
}

function showSelectedPillar(pillar){
	obj=document.getElementById(pillar);
	parentObj=document.getElementById('pillar_parent');
	childImgs=parentObj.getElementsByTagName('img');
	childDivs=parentObj.getElementsByTagName('div');
	
	
	for(i=0; i<childImgs.length;i++){
		if(childImgs[i].className=='pillar_blue'){
			childImgs[i].className='pillar_gray';
		}
	}
	obj.className='pillar_blue';
	
	document.getElementById('pillar1_unselctd').style.display='block';
	document.getElementById('pillar2_unselctd').style.display='block';
	document.getElementById('pillar3_unselctd').style.display='block';
	document.getElementById('pillar1_selctd').style.display='none';
	document.getElementById('pillar2_selctd').style.display='none';
	document.getElementById('pillar3_selctd').style.display='none';
	document.getElementById('pillar1_desc').style.display='none';
	document.getElementById('pillar2_desc').style.display='none';
	document.getElementById('pillar3_desc').style.display='none';

	document.getElementById(pillar+'_unselctd').style.display='none';
	document.getElementById(pillar+'_selctd').style.display='block';
	document.getElementById(pillar+'_desc').style.display='block';
}

