 function setupFadeLinks() {
  arrFadeLinks[0] = "/introduction/safety-privacy-security.php";
  arrFadeTitles[0] = "Only site to be ISO 9001:2000, VeriSign, TRUSTe Certified";
  arrFadeLinks[1] = "/introduction/why-we-are-no1.php";
  arrFadeTitles[1] = "Ranked the most visited matrimonial website in the world! - Ranking.com";
  arrFadeLinks[2] = "/introduction/why-we-are-no1.php";
  arrFadeTitles[2] = "\"Most preferred online matrimonial site for Indians\" - JuxtConsult";
}

// You can also play with these variables to control fade speed, fade color, and how fast the colors jump.

var m_FadeOut = 255;
var m_FadeIn=0;
var m_Fade = 0;
var m_FadeStep = 3;
var m_FadeWait = 1600;
var m_bFadeOut = true;

var m_iFadeInterval;

//window.onload = Fadewl;

var arrFadeLinks;
var arrFadeTitles;
var arrFadeCursor = 0;
var arrFadeMax;

function Fadewl() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
  arrFadeLinks = new Array();
  arrFadeTitles = new Array();
  setupFadeLinks();
  arrFadeMax = arrFadeLinks.length-1;
  setFadeLink();
}

function setFadeLink() {
  var ilink = document.getElementById("fade_link");
  ilink.innerHTML = arrFadeTitles[arrFadeCursor];
  ilink.href = arrFadeLinks[arrFadeCursor];
}

function fade_ontimer() {
  if (m_bFadeOut) {
    m_Fade+=m_FadeStep;
    if (m_Fade>m_FadeOut) {
      arrFadeCursor++;
      if (arrFadeCursor>arrFadeMax)
        arrFadeCursor=0;
      setFadeLink();
      m_bFadeOut = false;
    }
  } else {
    m_Fade-=m_FadeStep;
    if (m_Fade<m_FadeIn) {
      clearInterval(m_iFadeInterval);
      setTimeout(Faderesume, m_FadeWait);
      m_bFadeOut=true;
    }
  }
  var ilink = document.getElementById("fade_link");
  if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
    ilink.style.color = "#" + ToHex(m_Fade);
}

function Faderesume() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
}

function ToHex(strValue) {
  try {
    var result= (parseInt(strValue).toString(16));

    while (result.length !=2)
            result= ("0" +result);
    result = result + result + result;
    return result.toUpperCase();
  }
  catch(e)
  {
  }
}







function show_hide_login_layer() {
	clear_err_divs();
	var args = show_hide_login_layer.arguments;
	var do_what = args[0];
	if (do_what=='show') {
		//show_hide_more_layer('hide');
		//show_hide_profile_search_layer('hide');
		//enable_disable_form(document.forms['quicksearch'], 'disable');
		document.getElementById('login_layer').style.display = 'block';
		document.loginpage.login.focus();
	}
	else if (do_what=='hide') {
		if (document.loginpage) {
			document.loginpage.login.value = '';
			document.loginpage.password.value = '';
			//document.getElementById('id_spacer_1').style.display = 'block';
			document.getElementById('login_layer').style.display = 'none';
			//enable_disable_form(document.forms['quicksearch'], 'enable');
		}
	}
}

function validate_login_form() {
	clear_err_divs();
	var flag = false;
	if (document.loginpage.login.value=='') {
		document.getElementById('id_spacer_1').style.padding='3px';
		document.getElementById('login_err_div').style.display='block';
		document.getElementById('login_err_div').innerHTML='Please specify Email.';
		flag = true;
	}
	if (document.loginpage.password.value=='') {
		document.getElementById('password_err_div').style.display='block';
		document.getElementById('password_err_div').innerHTML='Please specify Password.';
		flag = true;
	}
	if (flag) {
		return false;
	}
	return true;
}
function clear_err_divs() {
	if (document.getElementById('login_err_div')) {
		document.getElementById('login_err_div').innerHTML = '';
	}
	if (document.getElementById('password_err_div')) {
		document.getElementById('password_err_div').innerHTML = '';
	}
	if (document.getElementById('profile_id_err_div')) {
		document.getElementById('profile_id_err_div').innerHTML = '';
	}
}



/*
*	function to set the timeout for active subtab to close
*
* @param  string  tabId		Top tab id which will get activated on clicking Page link
* @return
*
* @usage $var_name = function_name($param);
*/
var t
var timeout	= 50;

function subTabTimeout(subtabId,tabId){
//t = setTimeout("changeSubTabDisplay("+subtabId tabId+")",timeout);
t = setTimeout('changeSubTabDisplay('+subtabId+','+tabId+')',timeout);
}

function mcancelclosetime()
{
	if(t)
	{
		window.clearTimeout(t);
		t = null;
	}
}


var allTopTabs = []
var allSubTabs = []


function onloadAllTabs()
{
	//to take care of window resizing
	var panel = document.getElementById("nav_wrap").getElementsByTagName("div");

	//set the all the toptabs and subtabs in respective arrays
	for(var i=0;i<panel.length;i++)
	{
		if(panel.item(i).getAttribute( 'name' ) == 'toptab' )
		{
			allTopTabs.push( panel.item(i) );
		}
		if(panel.item(i).getAttribute( 'name' ) == 'subtab' )
		{
			allSubTabs.push( panel.item(i) );
		}
	}
}


function changeSubTabDisplay(subtabId,tabId) {
	//alert(tabId);
	//var parent = subtabId.parentNode.className
	//subtabId.parentNode.className = parent.replace("active","")

	var tabEl = tabId.parentNode;
	tabEl.className = tabEl.className.replace("active","");

	subtabId.style.display = "none";

	clearTimeout(t);

}
// FUNCTION ADDED BY DHANESH M
function changetab(tabId,action)
{
	var tabEl = document.getElementById(tabId).parentNode;
	var check = tabEl.className.match("active");
	
	if(action==1)
	{
		if (!check)
		tabEl.className = tabEl.className+" active";
	}
	else
	{
		tabEl.className = tabEl.className.replace("active","");
	}

}



/**
* function to return the type of top tab  "active" or "page active"
* "active" tab			- when the arrow image is clicked to view the dropdown
* "page active" tab	- the current page, when the user clicks the toptab link the tab	                          becomes "page active"
*
* @return
*
* @usage $var_name = function_name($param);
*/
function checkIfTabPageActive(tabParentClass){
//returns not null value if the tab is page active
return tabParentClass.match("page active")
}

function checkIfTabActive(tabParentClass){
//returns not null value if the tab is active
return tabParentClass.match("active")
}

function checkIfDropdown(tabParentClass){
	return tabParentClass.match("droptrue")
}

function setPageActiveTopTab(tabId)	{
	//clear the timeout variable
	clearTimeout(t)
	/* browse all toptabs and set the page active tab
	* set all the other to tabs to in-active state
	*/
	for(var i = 0; i<allTopTabs.length; i++){
		var getParentDiv = allTopTabs[i].parentNode
		var class_name = getParentDiv.className
		if(allTopTabs[i].id == tabId){
		//check if tab already active
		if(checkIfTabActive(class_name)){
		class_name = class_name.replace("page","")
		class_name = class_name.replace("active","")
		class_name = class_name.replace("droptrue","")
		}

		//set page active tab
		if(!checkIfTabPageActive(class_name)){
		getParentDiv.className = class_name + " page active droptrue"
		}
		subtab = allTopTabs[i].getAttribute("rel")

		}
		else{
		//set other tabs to in-active
		if(class_name.match("active")){
		class_name = class_name.replace("active","")
		}
		if(class_name.match("page"))	{
		class_name = class_name.replace("page","")
		}
		if(class_name.match("droptrue"))	{
		class_name = class_name.replace("droptrue","")
		}

		getParentDiv.className = class_name
		}//end of else

		
	}

	/* hide all subtabs */
	for(var i=0;i<allSubTabs.length;i++){
	allSubTabs[i].style.display="none"
	}


}

/*
store all the toptabs and subtabs in their respective arrays
required to be used by other functions
*/



function closeDropdownMenus(ev)
{
	//close dropdown menu when clicked elsewhere
	var node =(typeof event!=='undefined')? event.srcElement : ev.target

	while (node && !node.id)
	{
		node = node.offsetParent;
	}

	if(node && node.id.match("arrowtab"))
	{
		var tabstr = node.id.replace("arrow","");
		tabstr = "sub" + tabstr
	}
	for(var i = 0; i<allSubTabs.length; i++){
		if(allSubTabs[i].id == tabstr)
		continue;
		changeSubTabDisplay(allSubTabs[i])
	}
}

if (window.captureEvents)
{
	window.captureEvents(Event.CLICK);
	window.onclick=closeDropdownMenus;
}
else
{
	document.onclick=closeDropdownMenus;
}

function setActiveTopTab(tabId)	{
	//clear the timeout variable
	clearTimeout(t)
	/*
	browse all toptabs
	if page active tab, leave it as it is
	if any other tab is active , deactivate it
	set the selected tab to active state
	*/
	var subtab
	for(var i = 0; i<allTopTabs.length; i++){
		var getParentDiv = allTopTabs[i].parentNode
		var class_name = getParentDiv.className
			
		if(allTopTabs[i].id == tabId){
			//if active page
			//alert(class_name);
			if(checkIfTabPageActive(class_name)){
			//getParentDiv.className = class_name.replace("droptrue","")
			}
			//set active tab
			else if(!checkIfTabActive(class_name)){
			getParentDiv.className = class_name + " active"
			//arrow.src = img_src_dir + "arrow-down.gif"
			}
			else
			{
			//getParentDiv.className = class_name.replace("active","")
			}
			subtab = allTopTabs[i].getAttribute("rel")
		}
		else{
			if(!getParentDiv.className.match("page")){
			getParentDiv.className = class_name.replace("active","")
			}
			if(checkIfTabPageActive(class_name) && !class_name.match("droptrue")){
			getParentDiv.className = class_name + " droptrue"
			}
		}//end of else
	}

	/*
	browse all subtabs
	if the subtab is of the selected top tab, toggle its display
	hide all other subtabs
	*/
	for(var i = 0; i<allSubTabs.length; i++)
	{
		if(allSubTabs[i].id == subtab)
		{
	//set active sub tab
			if( allSubTabs[i].style.display == "none" || allSubTabs[i].style.display == "" )	
			{
				allSubTabs[i].style.display="block"
			}
			else
			{
				//allSubTabs[i].style.display="none"
			}//end of else
		}
		else
		{
			allSubTabs[i].style.display="none"
		}//end of else
	}
}





function show_menu(B,C,A)
{
	curleft=0;curtop=0;curright=0;

		if(C!='')
		{
			if(C.offsetParent)
			{
				do{curleft+=C.offsetLeft;curtop+=C.offsetTop}
				while
					(C=C.offsetParent)
			}
		}

		if (B != 6)
		{
			curleft-=A;
		}
		else
		{
			//getting windows width
			var winWidth = document.all?document.body.clientWidth:window.innerWidth;
			curleft = winWidth - curleft - A - 64;
		}
		
		
	
	
	curtop+=42;
	for(ctr=1;ctr<7;ctr++)
	{
		if(B==ctr)
		{
			continue
		}
		if(document.getElementById('menu_block'+ctr)!=null)
		{
			document.getElementById('menu_block'+ctr).style.display='none'
		}
	}

	if(B>0)
	{
		if(document.getElementById('menu_block'+B).style.display=='none')
		{
			document.getElementById('menu_block'+B).style.display='block';
			if (B == 6)
			{
				document.getElementById('menu_block'+B).style.right=curleft;
			}
			else
			{
				document.getElementById('menu_block'+B).style.left=curleft;
			}
			
			document.getElementById('menu_block'+B).style.top=curtop
		}
	}

}



function show_menu_myshaadi(B,C,A)
{
	
	curleft=0;curtop=0;curright=0;

		if(C!='')
		{
			if(C.offsetParent)
			{
				do{curleft+=C.offsetLeft;curtop+=C.offsetTop}
				while
					(C=C.offsetParent)
			}
		}

		if (B != 6)
		{
			if (navigator.appName == 'Netscape' )
			{
				curleft = curleft - A + 2;
			}else
			{
				curleft-=A;
			}
		}
		else
		{
			//getting windows width
			var winWidth = document.all?document.body.clientWidth:window.innerWidth;
			
			if (navigator.appName == 'Netscape' )
			{
				curleft = winWidth - curleft - A - 69;
			}
			else if (navigator.appName == "Microsoft Internet Explorer")
			{	
				var iewinWidth = document.documentElement.clientWidth;
				var arrAppVersion = navigator.appVersion.split(';');
		
				if (arrAppVersion[1]==' MSIE 7.0')
				{
					curleft = iewinWidth - curleft  - A - 63;	
				}
				else if ( arrAppVersion[1]==' MSIE 6.0' )
				{
					curleft = iewinWidth - curleft  - A - 67;	
				}
				else if ( arrAppVersion[1]==' MSIE 8.0' )
				{
					curleft = iewinWidth - curleft  - A - 51;	
				}
			
			}
			else
			{
				curleft = winWidth - curleft - A - 66;
			}
			
		}
		
	curtop+=42;
	for(ctr=1;ctr<7;ctr++)
	{
		if(B==ctr)
		{
			continue
		}
		if(document.getElementById('menu_block'+ctr)!=null)
		{
			document.getElementById('menu_block'+ctr).style.display='none'
		}
	}

	if(B>0)
	{
		if(document.getElementById('menu_block'+B).style.display=='none')
		{
			document.getElementById('menu_block'+B).style.display='block';
			if (B == 6)
			{
				document.getElementById('menu_block'+B).style.right=curleft;
			}
			else
			{
				document.getElementById('menu_block'+B).style.left=curleft;
			}
			
			document.getElementById('menu_block'+B).style.top=curtop
		}
	}

}


function arrow_display()
{
	
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		var arrAppVersion = navigator.appVersion.split(';');
		
		if (arrAppVersion[1]==' MSIE 7.0')
		{
			for (j=0; j<6; j++)
			{
				document.getElementById('arrowtab'+j).style.marginTop = '3';
					
			}
				
		}

	}
}




function show_hide_tooltip_layer()
{
	var B=show_hide_tooltip_layer.arguments;
	var A=B[0];
	if(A=="show")
	{
		document.getElementById("tooltip_layer").style.display="block"
	}
	else
	{
		if(A=="hide")
		{
			document.getElementById("tooltip_layer").style.display="none"
		}
	}
}
