function fnBookmark()
{
if (navigator.appName == "Netscape")
{
	window.sidebar.addPanel(window.document.title,parent.location.href,"");
}else if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
{
  window.external.AddFavorite(parent.location.href,window.document.title);
}else
{
	alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
}
	
}

function fnPageSubmit(txtURL,txtID)
{

	if(txtURL != '')
	{
		document.infForm.txtPageId.value = txtID;
		document.infForm.action = "/" + txtURL;
		document.infForm.submit();
	}
}

function fnAccSubmit(txtURL,txtID)
{

	if(txtURL != '')
	{
		document.infForm.txtId.value = txtID;
		document.infForm.action = "/" + txtURL;
		document.infForm.submit();
	}
}


function fnAccSubmit1(txtURL)
{

	if(txtURL != '')
	{
		
		document.infForm.action = "/" + txtURL;
		document.infForm.submit();
	}
}


function fnPageSubmitVidoes(txtURL,txtID)
{
	if(txtURL != '')
	{
	
		document.infForm.txtPageId.value = txtID;
		document.infForm.action = "/" + txtURL;
		document.infForm.submit();
	}
}

function SubmitLeftMenu(txtURL,txtID, breadCrumb)
{
	//alert(txtURL + "   " + txtID + "  " + breadCrumb);
	document.infForm.txtPageId.value = txtID;
	document.infForm.txtBreadCrumb.value = breadCrumb;
	document.infForm.action = "/" + txtURL;
	document.infForm.submit();
}

function fncShowDownloads()
{
	document.infForm.action = "/content/downloads.aspx";
	//document.infForm.action = "/content/download1.aspx";
	document.infForm.submit();
}

function OpenDocument(docId)
{
	//alert(window.location.href);
	funcNewOpen("/forms/showdocument.aspx?docId=" + docId + "&txtUrl=" + window.location.href );
}

function OpenDocumentWebinar(docId)
{
	//alert(window.location.href);
	funcNewOpenWebinar("/forms/showdocument.aspx?docId=" + docId + "&txtUrl=" + window.location.href );
}


function OpenDocumentDataCreep(docId)
{
	//alert(window.location.href);
	funcNewOpen("/forms/showdocdatacreep.aspx?docId=" + docId + "&txtUrl=" + window.location.href );
}


function OpenDissDocument(docId)
{
	funcNewOpen("/forms/showdissoldoc.aspx?docId=" + docId);
}


function fncSetValue(txtID, Referrer)
{
		document.infForm.txtPageId.value = txtID;
		document.infForm.txtReferer.value = Referrer;
	
}


function fncShowTab(id, Obj)
{
	var tab = document.getElementById(id);
	if(tab)
	{
		if(tab.style.display=='')
		{
			tab.style.display = 'none';
			Obj.innerHTML = "More";
		}
		else
		{
			tab.style.display = '';
			Obj.innerHTML = "Hide";
		}
	}
}

//********* Function For Search Web Parts *********//

function fncSearch(txtName)
{
	var obj = document.getElementById(txtName);
	if(obj.value.indexOf(" ")== 0)
	{
		alert("Search criteria cannot contain leading spaces.");
		obj.focus();
		return false;
	}
	if(obj.value =="")
	{
		alert("Search criteria cannot be left blank.");
		obj.focus();
		return false;
	}
	document.infForm.action = "/content/search.aspx?key=" + obj.value;
	document.infForm.submit();
}

function fn_ChkEnter(txtName)
{
	if(window.event.keyCode == 13)
	{
		fncSearch(txtName);	
		return false;
	}	
	return true;
}

//**** Function to Open New Window ***********//
function funcNewOpen(text){
	try{
		window.open(text,null,"location=no,toolbar=no,status=yes,scrollbars=yes,menubar=no,width=500,height=500,resizable=yes,dependent=yes").moveTo(0,0);
		
	}
	catch(e){
	}
}
function funcNewOpenWebinar(text){
	try{
		window.open(text,null,"location=no,toolbar=no,status=yes,scrollbars=yes,menubar=no,width=580,height=480,resizable=yes,dependent=yes").moveTo(0,0);
		
	}
	catch(e){
	}
}

//**** Function to Open New Window ***********//

// ********* Functions For Left Menu *********** //

function expand_nav(link)
{
	
	//alert(link.className + ' ' + link.tagName)
	/*if (link.className == 'down')
	{
		closeAll(link);
		link.className='down_open'
	}
	else
	{
		link.className='down'
	}*/
	var ul = find_enclosing_ul(link)
	//alert(ul.className);
	if (ul.className == 'open')
	{
		ul.className = 'close';
	}
	else
	{
		closeAll(link);
		ul.className = 'open'
	}
}
function closeAll(lnk)
{
	var pNode = lnk.parentNode.parentNode;
	for (var i=0;i<pNode.childNodes.length;i++)
	{
			for(var j=0;j<pNode.childNodes[i].childNodes.length;j++)
			{
				if (pNode.childNodes[i].childNodes[j].tagName == "UL")
				{
					pNode.childNodes[i].childNodes[j].className  = 'close';
					//pNode.childNodes[i].childNodes[0].className = 'down';
				}
			}
		
	}
	if(pNode.className == "left-menu")
	{
		var gNode= pNode.parentNode;
		for(var i=0;i<gNode.childNodes.length;i++)
		{
			if((gNode.childNodes[i].tagName == "UL") && (gNode.childNodes[i].className == "z"))
			{
				for(j=0;j<gNode.childNodes[i].childNodes.length;j++)
				{
					for(k=0;k<gNode.childNodes[i].childNodes[j].childNodes.length;k++)
					{
						if(gNode.childNodes[i].childNodes[j].childNodes[k].tagName ==  "UL")
						{
							gNode.childNodes[i].childNodes[j].childNodes[k].className  = 'close';
						}
					}
				}
			}
		}
	}
}
		
function find_enclosing_ul(link)
{
	try
	{
	var search_node = link
	while (true)
	{
		var node = search_node.nextSibling
		if (node && node.nodeName == 'UL')
		{
			break
		}
		else
		{
			search_node = node
		}
	}
	}
	catch(e)
	{
		//alert(e.message);
	}
	return node	
}

function fncSetLeftSelected()
{
	var obja = document.getElementById("leftSel");
	//alert(obja);
	var ul = find_enclosing_ul(obja);
	//alert(ul);
	if(ul)
	{
		ul.className = 'open'
	}
	var parent = obja.parentNode;
	//alert(parent);
	while(parent && parent.className  != 'left-menu')
	{
		if(parent.nodeName == "UL")
		{
			parent.className='open';
		}
		else if (parent.nodeName== "LI")
		{
			parent.childNodes[0].className='focus';
		}
		parent = parent.parentNode;
	}
}

// ********* Functions For Left Menu *********** //

// ********* careers page javascripts ********* /////

function fnOpenRes()
{
	window.open("http://203.200.233.232/careers/applyonline.aspx","new",'titlebar=no,menubar=no,toolbar=no,height=590,width=790,scroll=yes,resizable=yes').moveTo(0,0); 
	//window.open("atchRes.aspx")
}

function fn_GetPos(str)
{
  document.aspnetForm.txtHid.value=str;
   //alert(document.aspnetForm.txtHid.value);
   window.open("/forms/apply_new.aspx?pos="+str+" ",null,"location=no,status=1,width=600,height=450,scroll=yes,resizable=yes,scroll=yes").moveTo(0,0);
}

function fn_GetPosBang(str)
{
  document.aspnetForm.txtHid.value=str;
   //alert(document.aspnetForm.txtHid.value);
   window.open("/forms/Apply_New_bangalore.aspx?pos="+str+" ",null,"location=no,status=1,width=600,height=450,scroll=yes,resizable=yes,scroll=yes").moveTo(0,0);
}

// ********* careers page javascripts ********* /////


// ******  Script For Customer Login Portal **** //
function getNewSubmitForm(){
 var submitForm = document.createElement("FORM");
 document.body.appendChild(submitForm);
 submitForm.method = "POST";
 return submitForm;
}

function createNewFormElement(inputForm, elementName, elementValue){
 var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
 inputForm.appendChild(newElement);
 newElement.value = elementValue;
 return newElement;
}
function change_parent_url(url,username,password,user,comp_code)     
{ 
     var submitForm = getNewSubmitForm();
     createNewFormElement(submitForm, "option","login");
     createNewFormElement(submitForm, "username",username);
     createNewFormElement(submitForm, "passwd",password);
     createNewFormElement(submitForm, "user",user);
     createNewFormElement(submitForm, "comp_code",comp_code);
     submitForm.action=url;
     submitForm.submit();
}     
// ******  Script For Customer Login Portal **** //

// ********** Boomark Code *********//
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");
  }
}
// ********** Boomark Code *********//

/********* Page Recommend Code ***********/
function fnMailPage()
{
	window.open("/forms/pgrec.aspx?txtPageId=" + document.infForm.txtPageId.value,null,'location=no,toolbar=no,status=yes,scrollbars=yes,menubar=no,width=515,height=565,resizable=yes,dependent=yes').moveTo(0,0);
}
/********* Page Recommend Code ***********/

function we_customersupport()
{
	document.write("<br />");
	document.write("");
	document.write("<h3>Support Shortcuts</h3>");
	document.write("<ul class='category'>");
	document.write("<li><a href=javascript:fnPageSubmit('content/customer_support/call_archives.aspx',3401)>Call archives</a></li>");
	document.write("<li><a href='http://www.rhymesupport.com/hdsys.nsf/CAC/$SearchForm?SearchView' target='_blank'>Search for a call</a></li>");
	document.write("<li><a href='http://www.rhymesupport.com/hdsys.nsf/CWC?OpenView' target='_blank'>With client</a></li>");	
	document.write("<li><a href='http://www.rhymesupport.com/hdsys.nsf/CTC?OpenView' target='_blank'>Call status</a></li>");
	document.write("<li><a href='http://www.rhymesupport.com/hdsys.nsf/CRC?OpenView' target='_blank'>Resolved calls</a></li>");
	document.write("<li><a href='http://www.rhymesupport.com/welcome.nsf/Product Downloads?OpenView' target='_blank'>Product downloads</a></li>");
	document.write("<li><a href='http://www.rhymesupport.com/report1.nsf/RhymeSight?OpenView' target='_blank'>rhymeSIGHT Open Call Summary</a></li>");
	document.write("</ul>");
	document.write("<h3>Your details</h3>");
	document.write("<ul class='category'>");
	document.write("<li><a href='http://www.rhymesupport.com/hdsys.nsf/Client+Organisation+By+Username?OpenView' target='_blank'>Edit your details</a></li>");	//document.write("<li><a href='/twitter/' target='_blank'>Follow us on twitter</a></li>");
		document.write("<li><a href='https://www.rhymesupport.com/hdsys.nsf/CTC?changepassword' target='_blank'>Change your password</a></li>");
	document.write("</ul>");
	document.write("</div>");
	
/*	document.write("<div class='blurb-blue'>");

	document.write("</div>");
*/
}

function IncludeTwitterWidget()
{
	document.write("<div id='twtr-profile-widget'></div>");
	var script = document.createElement('script');
	script.src ="http://widgets.twimg.com/j/1/widget.js";
	script.type = 'text/javascript';
	script.defer = true;
	document.getElementsByTagName('head').item(0).appendChild(script);

	var lnk = document.createElement('Link');
	lnk.href="http://widgets.twimg.com/j/1/widget.css";
	lnk.type="text/css"
	lnk.rel ="stylesheet"
	document.getElementsByTagName('head').item(0).appendChild(lnk);

	new TWTR.Widget(
		{
			profile: true,
			id: 'twtr-profile-widget',
			loop: true,
			width: 200,
			height: 200,
			theme: 
				{ 
					shell: 
						{ 
							background: '#3082af',
							color: '#ffffff' 
						},
					tweets: 
						{ 
							background: '#ffffff',
							color: '#444444',
							links: '#1985b5' 
						}
				} 
			}).render().setProfile('3iInfotech').start();

}



function fnInsidePageSubmit(url)
{
	window.status='Calling Ajax...Please wait..';
	var parentid = document.infForm.txtPageId.value;
	//alert(parentid);
	oA = InfAjax();
	if(oA)
	{
		//alert("/forms/docpanel.aspx?LinkId="+linkid +"&Cnt="+Cnt);
		
		oA.open("GET","/forms/GetPageId.aspx?ParentId="+parentid+"&Url="+url,true);
		
		oA.onreadystatechange=function()
		{
			//alert("State : " + oA.readyState + " Text : " + oA.responseText + " Status : " + oA.status);
			if(oA.readyState==4)
			{
				if(oA.status == 200 || oA.status == 0)
				{
					//alert (linkid);
					var linkid = parseInt(oA.responseText);
					//alert(oA.responseText);
					document.infForm.txtPageId.value = linkid;
					document.infForm.action = url;
					document.infForm.submit();					
				}
				else
				{
					//alert(oA.responseText);
					//alert(oA.status + " Status");
					
				}
			}
			
		}
		oA.send(null);
	}

}

/*********************** Creating Ajax XML Object ***********************/
function InfAjax()
{
	var C=null;
	try
	{
		C=new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch(e)
	{
		try
		{
			C=new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch(sc)
		{
			C=null
		}
	}
	if(!C&&typeof XMLHttpRequest!="undefined")
	{
		C=new XMLHttpRequest()
	}
	return C
}
/*********************** Creating Ajax XML Object ***********************/

/*********************** Creating to Create twitter, facebook icon panel ***********************/
function fncIconPanel()
{
	document.write("<div align='right' style='background-color:#FFFFFF'><a href='http://www.facebook.com/pages/3i-Infotech/134894296538242' target='_blank' alt='Connect with 3i Infotech on Facebook' title='Connect with 3i Infotech on Facebook'><img src='/images/common/icon_facebook.gif'></a>&nbsp;&nbsp;<a href='http://www.linkedin.com/news?home=&gid=1163407&trk=anet_ug_news' target='_blank' alt='Connect with 3i Infotech on LinkedIn' title='Connect with 3i Infotech on LinkedIn'><img src='/images/common/icon_linkedin.gif'></a>&nbsp;&nbsp;<a href='/twitter/' target='_blank' alt='Follow 3i Infotech on Twitter' title='Follow 3i Infotech on Twitter'><img src='/images/common/icon_twitter.gif'></a>&nbsp;&nbsp;<a href='/content/rss/rss.aspx' alt='3i Infotech RSS Feeds' title='3i Infotech RSS Feeds'><img src='/images/common/icon_rss.gif'></a></div>");
}
/*********************** Creating to Create twitter, facebook icon panel ***********************/
/* Partner Portal Login */

function fncPartnerLogin(strWPID)
{
	var txtUserName = document.getElementById(strWPID+"_txtUserName");
	var txtPassword = document.getElementById(strWPID+"_txtPassword");
	if(txtUserName.value == "")
	{
		alert("Please enter the user name...");
		txtUserName.focus();
		return false;
	}
	if(txtPassword.value == "")
	{
		alert("Please enter the password...");
		txtPassword.focus();
		return false;
	}
	return true;
}


/**** For Video Popup Window ****/

function clicker(){
	var thediv=document.getElementById('displaybox');
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv.innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='middle' width='100%' height='100%'><object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' width='640' height='500'><param name='src' value='http://bitcast-b.bitgravity.com/botr/H1ZR5Wvk/videos/kzsu29V6-152131.mp4?e=1302535942&h=b7c2e1799fe74be24a1494da252c9535'><param name='bgcolor' value='#000000'><embed src='http://bitcast-b.bitgravity.com/botr/H1ZR5Wvk/videos/kzsu29V6-152131.mp4?e=1302535942&h=b7c2e1799fe74be24a1494da252c9535' autoplay='true' pluginspage='http://www.apple.com/quicktime/download/' height='500' width='640' bgcolor='#000000'></embed></object><br><br><a href='#' onclick='return clicker();'>CLOSE WINDOW</a></td></tr></table>";
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
	}
	return false;
}
