//-------------------------------------------------------------------------------------		
// Functions to initiate transparent menu onload
//-------------------------------------------------------------------------------------		

function init() {
			//==========================================================================================
			// if supported, initialize TransMenus
			//==========================================================================================
			// Check isSupported() so that menus aren't accidentally sent to non-supporting browsers.
			// This is better than server-side checking because it will also catch browsers which would
			// normally support the menus but have javascript disabled.
			//
			// If supported, call initialize() and then hook whatever image rollover code you need to do
			// to the .onactivate and .ondeactivate events for each menu.
			//==========================================================================================
			if (TransMenu.isSupported()) {
				TransMenu.initialize();

				// hook all the highlight swapping of the main toolbar to menu activation/deactivation
				// instead of simple rollover to get the effect where the button stays hightlit until
				// the menu is closed.
				
				menu1.onactivate = function() { document.getElementById('business1').src = './images/corebusiness_ro.gif';};
				menu1.ondeactivate = function() { document.getElementById('business1').src = './images/corebusiness.gif';};

				menu2.onactivate = function() { document.getElementById('careers1').src = './images/careers_ro.gif';};
				menu2.ondeactivate = function() { document.getElementById('careers1').src = './images/careers.gif';};

/*
				document.getElementById("umbria").onmouseover = function() {
					ms.hideCurrent();
					this.className = "hover";
				}
			

				document.getElementById("umbria").onmouseout = function() { this.className = ""; }
*/					
				
			}
		}
		
//--------------------------------------------------------------------------------
// Function to redirect on clicking on main categories on homepage
//--------------------------------------------------------------------------------
function setdoccookie(menucode,filename)
{
	document.cookie = 'sdmenu_my_menu='+menucode+'; expires=Thu, 2 Aug 20011 20:47:11 UTC; path=/';
	window.location = filename;

}
		

//-------------------------------------------------------------------------------------		
// Functions to Preload, Swap menu images
//-------------------------------------------------------------------------------------		
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//--------------------------------------------------------------------------------
// Function to validate 'Validate Feedback' Form
//--------------------------------------------------------------------------------
function validatefeedbackform()
{

	var msg = "";
	
	if (document.feedbackform.name.value == "") { msg = msg+"Name\n"; }
	if (document.feedbackform.company.value == "") { msg = msg+"Company\n"; }
	if (document.feedbackform.address.value == "") { msg = msg+"Address\n"; }
	if (document.feedbackform.city.value == "") { msg = msg+"City\n"; }
	if (document.feedbackform.state.value == "") { msg = msg+"State\n"; }
	if (document.feedbackform.country.value == "") { msg = msg+"Country\n"; }
	if (document.feedbackform.pincode.value == "") { msg = msg+"Pincode\n"; }
	if (document.feedbackform.email.value == "") { msg = msg+"Email\n"; }
	else
	{
		var emailReegxp = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/;
		if (!emailReegxp.test(document.feedbackform.email.value))
		{
			msg = msg+"Invalid Email Address\n";
		}
		
	}	
	if (document.feedbackform.phone.value == "") { msg = msg+"Telephone No.\n"; }
	if (document.feedbackform.mobile.value == "") { msg = msg+"Mobile\n"; }
	if (document.feedbackform.msg.value == "") { msg = msg+"Comments\n"; }
	if (document.feedbackform.security_code.value == "") { msg = msg+"Verification Code\n"; }
	if (msg != "") 
	{
		alert("Please fill in following Details\n\n"+msg);
		return false;
	}
	

	 
}

//--------------------------------------------------------------------------------
// Function to embed swf
//--------------------------------------------------------------------------------
function EmbedSWF1()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="939" height="330" hspace="0" vspace="0">');
	document.write('<param name="movie" value="top_anim.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="top_anim.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="939" height="330" hspace="0" vspace="0" SwLiveConnect="true" wmode="transparent"></embed>');
	document.write('</object>');
}



//--------------------------------------------------------------------------------
// Function to validate search form
//--------------------------------------------------------------------------------
function chkform1()
{
	if (document.form1.keywords.value == "")
	{ 
		alert('Please enter keywords to be searched');
		return false;
	}
}

//--------------------------------------------------------------------------------
// Function to validate search form on search.php
//--------------------------------------------------------------------------------
function chkinnerform()
{
	if (document.innersearchform.inner_keywords.value == "")
	{ 
		alert('Please enter keywords to be searched');
		return false;
	}

}

//--------------------------------------------------------------------------------
// Function to load animation images on
//--------------------------------------------------------------------------------
function loadimages()
{
	document.getElementById('slideshow1').style["display"]="block" ;
	document.getElementById('slideshow1').style["visibility"]="visible" ;
}

//--------------------------------------------------------------------------------
// Function to validate post resume form
//--------------------------------------------------------------------------------
function chk_post_resume_form()
{
	
	var msg = "";
	
	if (document.post_resume_form.candidate_name.value == "") { msg = msg + "Name\n";}
	if (document.post_resume_form.candidate_email.value == "") { msg = msg + "Email\n";}
	else
	{
		var emailReegxp = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/;
		if (!emailReegxp.test(document.post_resume_form.candidate_email.value))
		{
			msg = msg+"Invalid Email Address\n";
		}
		
	}
		
	if (document.post_resume_form.file.value == "") { msg = msg + "Attach Resume\n";}
	if (document.post_resume_form.sec_code.value == "") { msg = msg + "Verification Code\n";}
	
	
	if (msg != "")
	{
		alert("Please fill in following fields \n\n"+msg);
	}
	else
	{
		document.post_resume_form.submit();
	}
}

//--------------------------------------------------------------------------------
// Function to validate feedback form
//--------------------------------------------------------------------------------
function chk_feedbackform()
{
	
	var msg = "";
	if (document.feedbackform.title.value == "") { msg = msg + 'Title\n';}
	if (document.feedbackform.message.value == "") { msg = msg + 'Feedback\n';}
	
	if (msg != "")
	{
		alert('Please fill in following fields\n\n'+msg);
	}
	else
	{
		document.feedbackform.submit();
		
	}
	
}

//--------------------------------------------------------------------------------
// Function to validate employee change password form
//--------------------------------------------------------------------------------
function chk_chpwdform()
{
	var msg = "";
	if (document.chpwdform.currpwd.value == "") { msg = msg + 'Current Password\n';}
	if (document.chpwdform.newpwd.value == "") { msg = msg + 'New Password\n';}
	if (document.chpwdform.cnf_newpwd.value == "") { msg = msg + 'Confirm New Password\n';}
		
	if (msg != "")
	{
		alert('Please fill in following fields\n\n'+msg);
	}
	else if (document.chpwdform.newpwd.value != document.chpwdform.cnf_newpwd.value)
	{
		msg = 'New Passwords must match\n';
		alert(msg);
	}
	else
	{
		document.chpwdform.submit();
		
	}
}
