// Statrt PreLoginMaster.js Script
var url = window.location.href;
var nohttp = url.split('//')[1];
var hostPort = nohttp.split('/')[0]
var myurl = "http://" + hostPort + "/";
var LoopCount = 0;
var CategorySubSite = 0;
var FirstListItem;

//This function builds the 2nd Row in the Top Menu 
//TR is created in XSL file and trId is passed, to add the TD under trId
function BuildSubNavTR(trId, SubCategoryName, Category) {
	var tr = document.getElementById(trId);
	var cellCount = document.getElementById(trId).cells.length;
	var cell = tr.insertCell(document.getElementById(trId).cells.length);
	var StrInnerHTML = "<span style='font-size: 9pt; color: #016bb3; font-family: Arial'><a href='#' rel='GrandNav" + Category + SubCategoryName + "'>" + SubCategoryName + "</a>&nbsp;&nbsp;|&nbsp;</span>";

	cell.innerHTML = StrInnerHTML;

	var cellSpace = tr.insertCell(document.getElementById(trId).cells.length);
	cellSpace.setAttribute('width', '5');
}

//This function builds the DIV tags to create flyout menu (3rd level Menu in Top Menu).
function BuildProductCategoryTR(tblId, trId) {
	if (document.getElementById(tblId + trId) == null) {
		var tbl = document.getElementById(tblId);
		var trCount = tbl.rows.length;
		var tr = tbl.insertRow(trCount);
		var td = tr.insertCell(-1);

		var StrInnerHTML = "<div id='" + tblId + trId + "' class='dropmenudiv'></div>";
		trCount = tbl.rows.length;
		td.innerHTML = StrInnerHTML;
	}
}

//This function builds the Product Level Anchor tags.
//DIV tags built in 'BuildProductCategoryTR' function and passed to this funtion.
//Anchor tags are build under the DIV tags.
function BuildProductDiv(DivId, ProductName, URL) {
	var div = document.getElementById(DivId);
	if (div.innerHTML != null) div.innerHTML += "<a href='" + URL + "'>" + ProductName + "</a>";
	else div.innerHTML = "<a href='" + URL + "'>" + ProductName + "</a>";
}

function GetDefaultCategory(Category, RowCount) {
	if (CurrentPageCategory == Category) CategorySubSite = 1;

	if (LoopCount == 0) FirstListItem = Category;

	LoopCount = LoopCount + 1;
	if (LoopCount == RowCount) {
		if (CategorySubSite == 0)
			CurrentPageCategory = FirstListItem;
	}
}

function BuildMainMenu(divId, Category) {
	var divIdObj = document.getElementById(divId);
	var tableMainTabObj = document.getElementById('maintab');
	var strTrInnerHTML = "";
	var strInnerHTML = "";

	if (tableMainTabObj) {
		strTrInnerHTML = tableMainTabObj.rows[0].innerHTML;
		divIdObj.innerHTML = "";
	}

	if (CurrentPageCategory == Category) {
		strInnerHTML = "<td class='RGI_MenuButtonClk' onclick=document.location.href='" + CurrentSiteCollectionURL + "/" + Category + "';>" + Category + "</td>";
	}
	else {
		strInnerHTML = "<td class='RGI_MenuButton' onmouseover=this.className='RGI_MenuButtonClk' onmouseout=this.className='RGI_MenuButton' onclick=document.location.href='" + CurrentSiteCollectionURL + "/" + Category + "';>" + Category + "</td>";
	}

	var strRightMenu = "<table class='RGI_MenupanRight'><tr align='center'><td style='padding-right:20px' class='whitelinks'><a href='" + myurl + "Pages/Index.aspx' target='_top'>Home</a></td><td style='padding-right:20px' class='whitelinks'><a href='#' rel='dropmenu_abt'>About Us</a></td><td style='padding-right:20px' class='whitelinks'><a href='#' rel='dropmenu_news'>News Center</a></td><td style='padding-right:20px' class='whitelinks'><a href='#' rel='dropmenu_careers'>Careers</a></td><td style='padding-right:20px' class='whitelinks'><a href='" + myurl + "Pages/contact-us.aspx'>Contact Us</a></td><td style='padding-right:50px' class='whitelinks'><span><a href='#' rel='dropmenu19'>Join Us</a></span></td></tr></table>";

	divIdObj.innerHTML = "<div class='RGI_SubDiv'></div><table class='RGI_Menupan' width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td><table id='maintab' border='0' cellpadding='0' cellspacing='0'><tr>" + strTrInnerHTML + "<td style='width:4px;'></td>" + strInnerHTML + "</tr></table></td><td align='right'>" + strRightMenu + "</td><td width='1px'></td></tr></table>";
}

var imageurl = "";

function BuildTRUnderTopMenu() {
	document.write("<tr>")
	document.write("<td colspan='11' height='5' class='topnav_bgbottom'></td>")
	document.write("</tr>")
	document.write("<script type='text/javascript'>initalizetab('maintab')</script>")
}

function BuildTopSubRightMenu() {
	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='dropmenu19' class='dropmenudiv3'><a href='" + myurl + "Pages/become-agent.aspx'>As an Agent</a><a href='" + myurl + "Pages/brokers.aspx'>As a Broker</a></div></td></tr></table>");

	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='dropmenu_abt' class='dropmenudiv_abt'><a href='" + myurl + "Pages/reliance-capital.aspx'>Reliance General Insurance</a><a href='" + myurl + "Pages/brand-philosophy.aspx'>Our Brand Philosophy</a><a href='" + myurl + "Pages/corporate_info.aspx'>Board of Directors</a><a href='" + myurl + "Pages/management.aspx'>Management</a><a href='" + myurl + "Pages/operations.aspx'>Operations / Technology</a><a href='" + myurl + "Pages/quality.aspx'>Quality</a></div></td></tr></table>");

	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='dropmenu_news' class='dropmenudiv_abt'><a href='" + myurl + "Pages/reliance-in-news.aspx'>News</a><a href='" + myurl + "Pages/reliance-press-releases.aspx'>Press Releases</a></div></td></tr></table>");

	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr><td><div id='dropmenu_careers' class='dropmenudiv_abt'><a href='" + myurl + "Pages/work-culture.aspx'>Careers</a><a href='" + myurl + "Pages/our-dna-entrepreneurial.aspx'>Our DNA</a><a href='http://rclerecruitment.relianceada.com/hrapplications/rginsur.nsf/RGINSUR?OpenView&BaseTarget=main'>Current Openings</a></div></td></tr></table>");
}

// This function is to build News CQWP blank UL
function BuildNewsUL() {
	var objUL = document.getElementById("ULNewsItems");
	if (objUL == null) document.write("<ul id='ULNewsItems' class='listarrow'></ul>");
}

function BuildNewsItemsIL(LinkURL, NewsDesc) {
	var objUL = document.getElementById("ULNewsItems");
	var strInnerHTML = "<li><a class='link_black' href='" + LinkURL + "' target='_blank'>" + NewsDesc + "</a></li>";
	objUL.innerHTML += strInnerHTML;
}

function BuildPressReleaseMainUL() {
	var objUL = document.getElementById("ULPressRelease");
	if (objUL == null) document.write("<ul id='ULPressRelease' class='listarrow'></ul>");
}

function BuildPressReleaseUL() {
	var objUL = document.getElementById("ULPressRelease");
	if (objUL == null) document.write("<ul id='ULPressRelease'></ul>");
}

function BuildPressReleaseItemsIL(LinkURL, NewsDesc) {
	var objUL = document.getElementById("ULPressRelease");
	var strInnerHTML = "<li><a class='link_black' href=javascript:OpenWindow('" + LinkURL + "');>" + NewsDesc + "</a></li>";
	objUL.innerHTML += strInnerHTML;
}

function OpenWindow(url) {
	var newwindow;
	newwindow = window.open(url, 'survey', 'height=500 width=700,scrollbars=yes');
	newwindow.focus()
}

// function BuildRhsLi(Title, LinkURL) {
// var objUL = document.getElementById("spanGetInsInsurance");
// var LinkURLArray = LinkURL.split(",");
// var strInnerHTML = "<a href='" + LinkURLArray[0] + "' >" + Title + "</a>";
// objUL.innerHTML += strInnerHTML;
// }

function Querystring(QueryStringValue) { // optionally pass a querystring to parse
	this.params = {};
	if (QueryStringValue == null) QueryStringValue = location.search.substring(1, location.search.length);
	if (QueryStringValue.length == 0) return;

	// Turn <plus> back to <space>
	// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	QueryStringValue = QueryStringValue.replace(/\+/g, ' ');
	var args = QueryStringValue.split('&'); // parse out name/value pairs separated via &

	// split out each name = value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);

		var value = (pair.length == 2)
			? decodeURIComponent(pair[1])
			: name;
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}
// Statrt PreLoginMaster.js Script

// Start: topnav_dropdown.js Script
//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique

var cssdropdown = {
	disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
	disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
	enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
	enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

	//No need to edit beyond here////////////////////////
	dropmenuobj: null, ie: document.all, firefox: document.getElementById && !document.all, swipetimer: undefined, bottomclip: 0,

	getposOffset: function(what, offsettype) {
		var totaloffset = (offsettype == "left") ? what.offsetLeft : what.offsetTop;
		var parentEl = what.offsetParent;
		while (parentEl != null) {
			totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
			parentEl = parentEl.offsetParent;
		}
		return totaloffset;
	},

	swipeeffect: function() {
		if (this.bottomclip < parseInt(this.dropmenuobj.offsetHeight)) {
			this.bottomclip += 10 + (this.bottomclip / 10) //unclip drop down menu visibility gradually
			this.dropmenuobj.style.clip = "rect(0 auto " + this.bottomclip + "px 0)"
		}
		else
			return
		this.swipetimer = setTimeout("cssdropdown.swipeeffect()", 10)
	},

	showhide: function(obj, e) {
		if (this.ie || this.firefox)
			this.dropmenuobj.style.left = this.dropmenuobj.style.top = "-500px"
		if (e.type == "click" && obj.visibility == hidden || e.type == "mouseover") {
			if (this.enableswipe == 1) {
				if (typeof this.swipetimer != "undefined")
					clearTimeout(this.swipetimer)
				obj.clip = "rect(0 auto 0 0)" //hide menu via clipping
				this.bottomclip = 0
				this.swipeeffect()
			}
			obj.visibility = "visible"
		}
		else if (e.type == "click")
			obj.visibility = "hidden"
	},

	iecompattest: function() {
		return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
	},

	clearbrowseredge: function(obj, whichedge) {
		var edgeoffset = 0
		if (whichedge == "rightedge") {
			var windowedge = this.ie && !window.opera ? this.iecompattest().scrollLeft + this.iecompattest().clientWidth - 15 : window.pageXOffset + window.innerWidth - 15
			this.dropmenuobj.contentmeasure = this.dropmenuobj.offsetWidth
			if (windowedge - this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
				edgeoffset = this.dropmenuobj.contentmeasure - obj.offsetWidth
		}
		else {
			var topedge = this.ie && !window.opera ? this.iecompattest().scrollTop : window.pageYOffset
			var windowedge = this.ie && !window.opera ? this.iecompattest().scrollTop + this.iecompattest().clientHeight - 15 : window.pageYOffset + window.innerHeight - 18
			this.dropmenuobj.contentmeasure = this.dropmenuobj.offsetHeight
			if (windowedge - this.dropmenuobj.y < this.dropmenuobj.contentmeasure) { //move up?
				edgeoffset = this.dropmenuobj.contentmeasure + obj.offsetHeight
				if ((this.dropmenuobj.y - topedge) < this.dropmenuobj.contentmeasure) //up no good either?
					edgeoffset = this.dropmenuobj.y + obj.offsetHeight - topedge
			}
		}
		return edgeoffset
	},

	dropit: function(obj, e, dropmenuID) {
		if (this.dropmenuobj != null) //hide previous menu
			this.dropmenuobj.style.visibility = "hidden" //hide menu
		this.clearhidemenu()
		if (this.ie || this.firefox) {
			obj.onmouseout = function() { cssdropdown.delayhidemenu() }
			obj.onclick = function() { return !cssdropdown.disablemenuclick } //disable main menu item link onclick?
			this.dropmenuobj = document.getElementById(dropmenuID)
			this.dropmenuobj.onmouseover = function() { cssdropdown.clearhidemenu() }
			this.dropmenuobj.onmouseout = function(e) { cssdropdown.dynamichide(e) }
			this.dropmenuobj.onclick = function() { cssdropdown.delayhidemenu() }
			this.showhide(this.dropmenuobj.style, e)
			this.dropmenuobj.x = this.getposOffset(obj, "left")
			this.dropmenuobj.y = this.getposOffset(obj, "top")
			this.dropmenuobj.style.left = this.dropmenuobj.x - this.clearbrowseredge(obj, "rightedge") + "px"
			this.dropmenuobj.style.top = this.dropmenuobj.y - this.clearbrowseredge(obj, "bottomedge") + obj.offsetHeight + 1 + "px"
			this.positionshim() //call iframe shim function
		}
	},

	positionshim: function() { //display iframe shim function
		if (this.enableiframeshim && typeof this.shimobject != "undefined") {
			if (this.dropmenuobj.style.visibility == "visible") {
				this.shimobject.style.width = this.dropmenuobj.offsetWidth + "px"
				this.shimobject.style.height = this.dropmenuobj.offsetHeight + "px"
				this.shimobject.style.left = this.dropmenuobj.style.left
				this.shimobject.style.top = this.dropmenuobj.style.top
			}
			this.shimobject.style.display = (this.dropmenuobj.style.visibility == "visible") ? "block" : "none"
		}
	},

	hideshim: function() {
		if (this.enableiframeshim && typeof this.shimobject != "undefined")
			this.shimobject.style.display = 'none'
	},

	contains_firefox: function(a, b) {
		while (b.parentNode)
			if ((b = b.parentNode) == a)
			return true;
		return false;
	},

	dynamichide: function(e) {
		var evtobj = window.event ? window.event : e
		if (this.ie && !this.dropmenuobj.contains(evtobj.toElement))
			this.delayhidemenu()
		else if (this.firefox && e.currentTarget != evtobj.relatedTarget && !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
			this.delayhidemenu()
	},

	delayhidemenu: function() {
		this.delayhide = setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()", this.disappeardelay) //hide menu
	},

	clearhidemenu: function() {
		if (this.delayhide != "undefined")
			clearTimeout(this.delayhide)
	},

	startchrome: function() {
		for (var ids = 0; ids < arguments.length; ids++) {
			var menuitems = document.getElementById(arguments[ids]).getElementsByTagName("a")
			for (var i = 0; i < menuitems.length; i++) {
				if (menuitems[i].getAttribute("rel")) {
					var relvalue = menuitems[i].getAttribute("rel")
					menuitems[i].onmouseover = function(e) {
						var event = typeof e != "undefined" ? e : window.event
						cssdropdown.dropit(this, event, this.getAttribute("rel"))
					}
				}
			}
		}
		if (window.createPopup && !window.XmlHttpRequest) { //if IE5.5 to IE6, create iframe for iframe shim technique
			document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
			this.shimobject = document.getElementById("iframeshim") //reference iframe object
		}
	}
}
// End: topnav_dropdown.js Script

// Start: 2leveltab Script
var mastertabvar = new Object()
mastertabvar.baseopacity = 0
mastertabvar.browserdetect = ""

function showsubmenu(masterid, id) {
	document.getElementById(id).style.display = "block"
	/*if (typeof highlighting!="undefined")
	clearInterval(highlighting)
	submenuobject=document.getElementById(id)
	mastertabvar.browserdetect=submenuobject.filters? "ie" : typeof submenuobject.style.MozOpacity=="string"? "mozilla" : ""
	hidesubmenus(mastertabvar[masterid])
	submenuobject.style.display="block"
	instantset(mastertabvar.baseopacity)
	highlighting=setInterval("gradualfade(submenuobject)",50)*/
}

function hidesubmenus(submenuarray) {
	for (var i = 0; i < submenuarray.length; i++)
		document.getElementById(submenuarray[i]).style.display = "none"
}

function instantset(degree) {
	if (mastertabvar.browserdetect == "mozilla")
		submenuobject.style.MozOpacity = degree / 100
	else if (mastertabvar.browserdetect == "ie")
		submenuobject.filters.alpha.opacity = degree
}

function gradualfade(cur2) {
	if (mastertabvar.browserdetect == "mozilla" && cur2.style.MozOpacity < 1)
		cur2.style.MozOpacity = Math.min(parseFloat(cur2.style.MozOpacity) + 0.1, 0.99)
	else if (mastertabvar.browserdetect == "ie" && cur2.filters.alpha.opacity < 100)
		cur2.filters.alpha.opacity += 10
	else if (typeof highlighting != "undefined") //fading animation over
		clearInterval(highlighting)
}

function initalizetab(tabid) {
	mastertabvar[tabid] = new Array()
	var menuitems = document.getElementById(tabid).getElementsByTagName("li")
	for (var i = 0; i < menuitems.length; i++) {
		if (menuitems[i].getAttribute("rel")) {
			menuitems[i].setAttribute("rev", tabid) //associate this submenu with main tab
			mastertabvar[tabid][mastertabvar[tabid].length] = menuitems[i].getAttribute("rel") //store ids of submenus of tab menu
			if (menuitems[i].className == "selected")
				showsubmenu(tabid, menuitems[i].getAttribute("rel"))
			menuitems[i].getElementsByTagName("a")[0].onmouseclick = function() {
				showsubmenu(this.parentNode.getAttribute("rev"), this.parentNode.getAttribute("rel"))
			}
		}
	}
}
// End: 2leveltab Script

// Start: Footer Script
var url = window.location.href;
var nohttp = url.split('//')[1];
var hostPort = nohttp.split('/')[0]
var myurl = "http://" + hostPort + "/";
function footer_landing() {
	document.write("<div align='center'>")
	document.write("<table cellpadding='0' cellspacing='0' border='0' width='99%'>")
	document.write("<tr><td align='center'>")
	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr>")
	document.write("<td height='33'><span style='font-size: 8pt; font-family: Arial; color: #016bb3'><a href='" + myurl + "Pages/UserFeedbackPage.aspx' class='footerlinks'>Feedback</a> &nbsp;| &nbsp;<a href='" + myurl + "Pages/sitemap.aspx' class='footerlinks'>User Sitemap</a> &nbsp;| &nbsp;<a href='http://www.irdaindia.org/' class='footerlinks' target='_blank'>IRDA</a> &nbsp; |&nbsp; <a href='" + myurl + "Pages/fundamentals.aspx' class='footerlinks'>Fundamentals of General Insurance</a> &nbsp;|&nbsp; <a href='" + myurl + "Pages/insurance-group-cos.aspx' class='footerlinks'>Reliance ADA Group Companies</a> &nbsp;| &nbsp;<a href='" + myurl + "Pages/downloads-brochure.aspx' class='footerlinks'>Downloads</a> &nbsp; | &nbsp;<a href='" + myurl + "Pages/Public Disclosure.aspx' class='footerlinks'>Public Disclosure</a> &nbsp; | &nbsp;<a href='" + myurl + "Pages/glossary.aspx' class='footerlinks'>Glossary</a></span></td>")
	document.write("</tr></table>")
	document.write("</td></tr>")
	document.write("<tr><td height='2'></td></tr>")
	document.write("<tr><td height='2' bgcolor='#016bb3'></td></tr>")
	document.write("<tr><td height='5'></td></tr>")
	document.write("<tr><td>")
	document.write("<table width='100%' cellpadding='0' cellspacing='0' border='0'>")
	document.write("<tr><td width='1%'></td>")
	document.write("<td width='6%'><img src='../../Style%20Library/Reliance/images/ISO-9001_footer.gif' alt=''></td><td width='1%'></td>")
	document.write("<td width='50%' class='footer' align='left'><b>Reliance General Insurance Company Limited.</b> All rights reserved<br><b>Registered Office:</b> Reliance Centre, 19 Walchand Hirachand Marg, Ballard Estate, Mumbai - 400 001.<br>IRDA Reg. No. 103 dated 23/10/2000. Insurance is the subject matter of solicitation.")
	document.write("</td>")
	document.write("<td width=''></td>")
	document.write("<td width='41%' valign='top' align='center'>")
	document.write("<table cellpadding='0' cellspacing='0' border='0'><tr>")
	document.write("<td><span style='font-size: 8pt; font-family: Arial; color: #016bb3'><a href='" + myurl + "Pages/termsnconditions.aspx' class='footerlinks'>Terms &amp; Conditions</a> &nbsp;| &nbsp; <a href='" + myurl + "Pages/disclaimer.aspx' class='footerlinks'>Disclaimer</a> &nbsp;| &nbsp; <a href='" + myurl + "Pages/privacy-policy.aspx' class='footerlinks'>Privacy Policy</a> &nbsp;| &nbsp; <a href='" + myurl + "sitemap.htm' class='footerlinks'>Sitemap</a> &nbsp;| &nbsp; <a href='" + myurl + "Links/index.htm' class='footerlinks'>Links</a></span>")
	document.write("</tr>")
	document.write("<tr><td height='10'></td></tr><tr><td align='right' style='color:red;'>Best viewed in Internet Explorer 6.0 & above")
	document.write("</td></tr>")
	document.write("</table>")
	document.write("</td></table>")
	document.write("</td></tr></table>")
	document.write("</div>")
}
// End: Footer Script

// Start: PageLayoutScript.js Script
//This function builds the Sub Category in the Site Map
//TR is created in XSL file and trId is passed, to add the TD under trId
function SiteMapBuildCategoryTR(trId, CategoryName, SubCategory) {
	var tr = document.getElementById(trId);
	var cellCount = document.getElementById(trId).cells.length;
	var tdCheck = document.getElementById(SubCategory + CategoryName);
	if (tdCheck == null) {
		var cell = tr.insertCell(document.getElementById(trId).cells.length);
		cell.setAttribute('width', '17%');
		cell.setAttribute('id', SubCategory + CategoryName);
		var strInnerHTML = "<div class =sitemap_heading>" + SubCategory + "</div><table><tr><td><ul class=sitemap_links id='tblLinks" + CategoryName + SubCategory + "'></ul></td></tr></table></div>";
		cell.innerHTML = strInnerHTML;
	}
}

//This function builds the red lines in SiteMap 
function SiteMapHeader(tdId, trId) {
	var tr = document.getElementById(trId);
	var cellCount = document.getElementById(trId).cells.length;
	var row = document.getElementById(tdId);
	row.deleteCell(0);
	var cell = row.insertCell(row.cells.length);
	var strInnerHTML = "<img src=\"" + "../../Style Library/Reliance/Images/spacer.gif" + "\" height=\"" + "1" + "\"></img>";
	cell.className = "heading_underline";
	cell.colSpan = cellCount;
	cell.innerHTML = strInnerHTML;
}

//This function builds the Page Titles  in the Site Map
//Table is created in SiteMapBuildCategoryTR function , TR and TD are added in this function
function SiteMapBuildSubCategoryTR(tblId, SafeLinkUrl, DisplayTitle) {
	var ulElement = document.getElementById(tblId);
	var StrInnerHTML = "<li><a class = sitemap_links li a	 href='" + SafeLinkUrl + "'>" + DisplayTitle + "</a></li>";
	ulElement.innerHTML += strInnerHTML;
}

//This Function is used for Category Landing Page for displaying round arrow image and page list from Pages Library
function CategoryLandingTR(tblId, SafeLinkUrl, DisplayTitle) {
	var tbl;
	tbl = document.getElementById(tblId);
	var row;
	row = tbl.insertRow(0);
	var cell;
	cell = row.insertCell(0);
	var strInnerHTML = "<br /><img src='../../Style Library/Reliance/Images/round_arrow.gif' />&nbsp;&nbsp;" + "<a class='bluelinksmall' href='" + SafeLinkUrl + "'>" + DisplayTitle + "</a>";
	cell.innerHTML = strInnerHTML;
}

//Functions for Download Brochures and Forms Pages
function BuildEngUL(engLiID, tdId) {
	var objTD = document.getElementById(tdId);
	var strEngUL = "<ul class='liststyle_lvl2'><li id='" + engLiID + "'></li></ul>";
	objTD.innerHTML += strEngUL;
}

function BuildEngLink(engLiID, ProductTitle, ProductURL) {
	var ankID = "ank" + engLiID;
	var objLi = document.getElementById(engLiID);
	var strInnerHTML = "<a id='" + ankID + "' href='" + ProductURL + "' target='_blank'>" + ProductTitle + "</a> &nbsp; <a id='" + ankID + "_Email' onclick=\"window.open('/CustomePage/GenericEmailSmsSend.aspx?CommType=EMail&FileUrl=" + ProductURL + "&Title=" + ProductTitle + "', '', 'width=250, height=150, scrollbars=0', false); return true;\" href='#' style='color:red'> >Email </a>";
	objLi.innerHTML = strInnerHTML + objLi.innerHTML;

	var objlinkid = document.getElementById(engLiID).getElementsByTagName("a");
}

//Functions for Download Brochures Page
function BuildOtherLangUl(OtherLangULID, engLiID) {
	var objUL = document.getElementById(OtherLangULID);
	if (objUL == null) {
		var objEngLi = document.getElementById(engLiID);
		var strInnerHTML = "<ul><br/><li class='langdrpdwn'><a class='language' href='#' onClick=DisplayOtherLang('Div" + OtherLangULID + "')>Click for language version</a><div class='regional' style='display:none' id='Div" + OtherLangULID + "'><ul id='" + OtherLangULID + "'></ul></div></li></ul>";
		objEngLi.innerHTML += strInnerHTML;
	}
}

function BuildOtherLangLinks(OtherLangULID, Lang, ProductURL) {
	var objUL = document.getElementById(OtherLangULID);
	var strInnerHTML = "<li><a href='" + ProductURL + "' class='bluelink' target='_blank'>" + Lang + "</a> &nbsp; <a onclick=\"window.open('/CustomePage/GenericEmailSmsSend.aspx?CommType=EMail&FileUrl=" + ProductURL + "&Title=Reliance Insurance Product Brochure', '', 'width=250, height=150, scrollbars=0', false); return true;\" href='#' style='color:red'> >Email </a></li>";
	objUL.innerHTML += strInnerHTML;
}

function DisplayOtherLang(ULId) {
	if (document.getElementById(ULId).style.display == 'none') document.getElementById(ULId).style.display = 'block';
	else if (document.getElementById(ULId).style.display == 'block') document.getElementById(ULId).style.display = 'none';
}
// End: PageLayoutScript.js Script

// Start: tabcontent.js Script
//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06

var enabletabpersistence = 1 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs = new Object()

function expandcontent(linkobj) {
	var ulid = linkobj.parentNode.parentNode.id //id of UL element
	var ullist = document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
	for (var i = 0; i < ullist.length; i++) {
		ullist[i].className = ""  //deselect all tabs
		if (typeof tabcontentIDs[ulid][i] != "undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
			document.getElementById(tabcontentIDs[ulid][i]).style.display = "none" //hide all tab contents
	}
	linkobj.parentNode.className = "selected"  //highlight currently clicked on tab
	document.getElementById(linkobj.getAttribute("rel")).style.display = "block" //expand corresponding tab content
	saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber) { //interface for selecting a tab (plus expand corresponding content)
	var thetab = document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
	if (thetab.getAttribute("rel"))
		expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute) {// save ids of tab content divs
	if (typeof tabcontentIDs[ulid] == "undefined") //if this array doesn't exist yet
		tabcontentIDs[ulid] = new Array()
	tabcontentIDs[ulid][tabcontentIDs[ulid].length] = relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid) { //set id of clicked on tab as selected tab id & enter into cookie
	if (enabletabpersistence == 1) //if persistence feature turned on
		setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid) { //returns a tab link based on the ID of the associated tab content
	var ullist = document.getElementById(ulid).getElementsByTagName("li")
	for (var i = 0; i < ullist.length; i++) {
		if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel") == tabcontentid) {
			return ullist[i].getElementsByTagName("a")[0]
			break
		}
	}
}

function initializetabcontent(firsttab, tabcontent) {
	if (tabcontent == "initial") {
		setCookie('firsttab', 'tcontent1')
	}

	for (var i = 0; i < arguments.length; i++) { //loop through passed UL ids
		if (enabletabpersistence == 0 && getCookie(arguments[i]) != "") //clean up cookie if persist=off
			setCookie(arguments[i], "")
		var clickedontab = getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
		var ulobj = document.getElementById(arguments[i])
		var ulist = ulobj.getElementsByTagName("li") //array containing the LI elements within UL
		for (var x = 0; x < ulist.length; x++) { //loop through each LI element
			var ulistlink = ulist[x].getElementsByTagName("a")[0]
			if (ulistlink.getAttribute("rel")) {
				savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
				ulistlink.onclick = function() {
					expandcontent(this)
					return false
				}
				if (ulist[x].className == "selected" && clickedontab == "") //if a tab is set to be selected by default
					expandcontent(ulistlink) //auto load currenly selected tab content
			}
		} //end inner for loop
		if (clickedontab != "") { //if a tab has been previously clicked on per the cookie value
			var culistlink = getullistlinkbyId(arguments[i], clickedontab)
			if (typeof culistlink != "undefined") //if match found between tabcontent id and rel attribute value
				expandcontent(culistlink) //auto load currenly selected tab content
			else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
				expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
		}
	} //end outer for loop
}

function getCookie(Name) {
	var re = new RegExp(Name + "=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

function setCookie(name, value) {
	//document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

function openDiv() {
	setCookie('firsttab', 'tcontent3')
	initializetabcontent('firsttab', 'tcontent3')
}
// End: tabcontent.js Script

// Start: User.js Script
function Checkonlaim(ctrlText, ctrlMessage) {
	if (document.getElementById(ctrlText).value == "") {
		document.getElementById(ctrlMessage).innerText = "Please enter Claim Reference No";
		return false;
	}
	document.getElementById(ctrlMessage).innerText = "";
	return true;
}

function CheckonInstantQuoteCheck(ctrlProduct, ctrlMessage) {
	if (document.getElementById(ctrlProduct).value == "-1") {
		document.getElementById(ctrlMessage).style.display = "block";
		document.getElementById(ctrlMessage).innerText = "Please Select a Product";
		return false;
	}
	document.getElementById(ctrlMessage).innerText = "";
	document.getElementById(ctrlMessage).style.display = "none"
	return true;
}

function CheckonlCRMCall(ctrlMobile, ctrlProduct, ctrlMessage1) {
	if ((document.getElementById(ctrlMobile).value == "Mobile No.") || (document.getElementById(ctrlMobile).value == "")) {
		document.getElementById(ctrlMessage1).style.display = "block";
		document.getElementById(ctrlMessage1).innerText = "Please enter MobileNo";
		return false;
	}
	if ((document.getElementById(ctrlProduct).value == "-1")) {
		document.getElementById(ctrlMessage1).style.display = "block";
		document.getElementById(ctrlMessage1).innerText = "Please Select a Product";
		return false;
	}
	document.getElementById(ctrlMessage1).innerText = "";
	document.getElementById(ctrlMessage1).style.display = "none";
	return true;
}

function CheckonloginClick(ctrlUser, ctrlPasswordMask, ctrlPassword, ctrlMessage) {
	var prefix = "Login$"
	if ((document.getElementById(ctrlUser).value == "Enter Email ID") || (document.getElementById(ctrlPassword).value == "Password") || (document.getElementById(ctrlPassword).value == "") || (document.getElementById(ctrlUser).value == "")) {
		document.getElementById(ctrlMessage).style.display = "block";
		document.getElementById(ctrlMessage).innerText = "Please enter UserId and Password";
		return false;
	}
	document.getElementById(ctrlMessage).innerText = "";
	document.getElementById(ctrlMessage).style.display = "none";
	return true;
}

function passwordTextBoxOnFocus(ctrlPassword, ctrlPasswordmask) {
	document.getElementById(ctrlPasswordmask).style.display = 'none';
	var passwordTextBoxRef = document.getElementById(ctrlPassword);
	passwordTextBoxRef.style.display = 'block';
	passwordTextBoxRef.select();
	passwordTextBoxRef.focus();
}

function MaskTextBoxOnFocus(ctrlUserid, ctrlPassword, ctrlPasswordmask) {
	if (document.getElementById(ctrlPassword).value == "") {
		document.getElementById(ctrlPassword).style.display = 'none';
		var passwordTextBoxRef = document.getElementById(ctrlPasswordmask);
		passwordTextBoxRef.style.display = 'block';
		if (document.getElementById(ctrlUserid).value == "Enter Email ID") {
		}
		else {
			document.getElementById(ctrlUserid).style.color = "black";
		}
	}
}

function ChangeUserIdonFocus(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "Enter Email ID") document.getElementById(ctrl).value = "";
}

function ChangeUserIdonBlur(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "") document.getElementById(ctrl).value = "Enter Email ID";
}

function ChangeMobileNoonBlur(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "") document.getElementById(ctrl).value = "Mobile No.";
	else validateMobileNumber(ctrl);
}

function ChangeMobileonFocus(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "Mobile No.") document.getElementById(ctrl).value = "";
}

function ChangePasswordonFocus(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "Password") document.getElementById(ctrl).value = "";
}

function ChangePasswordonBlur(ctrl) {
	var prefix = "Login$"
	if (document.getElementById(ctrl).value == "") document.getElementById(ctrl).value = "Password";
}
// End: User.js Script

// Start: Home Page Layout Load
function HomePageLayoutLoad() {
//var ImageLocation = myurl + "Pages/Celebrate_Age-2.html";
//window.open(ImageLocation, '', 'status=1,scrollbars=0,width=210px,height=482px');
}
// End: Home Page Layout Load