function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

function change_size(whatstyle) {	
	 document.getElementById('currentstyle').href="css/zs_fonts_"+whatstyle+".css";
	// alert(document.getElementById('current_style').href);
}

//drop down refresh
var firstselect;
function resetOptionList(what) {
    if (firstselect=='yes') {
        document.getElementById(what).selectedIndex=0;
        firstselect='no';
    }
    if (document.getElementById(what).selectedIndex!=0) firstselect='yes';
}
//form submission without setting any parameter
function submitForm(aform_name){
		var aform = document.getElementById(aform_name);
		aform.submit();
}
//open links
function openlink(aform_name,url){
	var aform = document.getElementById(aform_name);
	aform.action=url;
	if(url == 'http://isecurity.zenithsecuritiesng.com/symbols/'){
		aform.target="_blank";
	}
	if(url == 'adps.html'){
		window.open(url,'','height=600px, width=800px,menubar=false,location=false,status=false');
		//aform.target="_blank";
	}else{
		aform.submit();
	}
}
//Mouse Overs effects
function changeImage(obj,url){
	//obj.src="http://"+domain+url;
}
function setTextColor(obj,color){
	obj.style.color=color;
}
function setBackgroundColor(obj,color){
	obj.style.backgroundColor=color;
}
function setTopBorderColorAndSize(obj,color,size){
	//alert(obj);
	obj.style.borderTopStyle="solid";
	obj.style.borderTopWidth="1px";
	obj.style.borderTopColor=color;
}
function setRightBorderColorAndSize(obj,color,size){
	//alert(obj);
	obj.style.borderRightStyle="solid";
	obj.style.borderRightWidth="1px";
	obj.style.borderRightColor=color;
}
function setDivHeight(divobj1,divobj2){
	//alert(divobj2.style.height);
	//divobj1.style.top = divobj2.style.height;
}
function spaceOutChars1px(obj){
	//alert(obj.style.textTransform);
	//obj.style.fontWeight = "bold";
	//alert(obj.style.fontSize);
	obj.style.letterSpacing = "1px";
}
function unSpaceOutChars1px(obj){
	//alert(obj.style.textTransform);
	//obj.style.fontWeight = "normal";
	obj.style.letterSpacing = "0px";
}
function focusAndClearTextBox(obj){
	//alert('good');
	obj.value = "";
	obj.focus();
	//alert('bad');
}
function b_focus(obj, color){
	obj.style.backgroundColor = color;
}
function b_defocus(obj, color){
	obj.style.backgroundColor = color;
}
function prevent_link_underline(obj){
	//alert(obj);
	obj.style.color = '#ef0000';
}
/*
Check required form elements script-
By JavaScript Kit (http://javascriptkit.com)
Over 200+ free scripts here!
*/

function validateLoginForm(frmobj){
	if(frmobj.email.value==""){ 
		alert("please provide user name");
		frmobj.email.focus();
		return false;
		//frmobj.reset();
	}else{
		if(frmobj.password.value==""){ 
			alert("please provide password");
			frmobj.password.focus();
			return false;
		}else{
			return true;
		}
	}
}

function validateLocationsSearch(frmobj){
	if(frmobj.cities.value=="Z-Please Select"){ 
		alert("please select a City/Town/State");
		frmobj.branchname.focus();
		return false;
	}else{
		frmobj.submit();
		return true;
	}
}

function validateMailMyPassword(frmobj){
	if(frmobj.email.value==""){ 
		alert("please enter your email address");
		frmobj.email.focus();
		return false;
	}else{
		frmobj.submit();
		return true;
	}
}

function suw(){
	//window.open("thankyounigeria.cfm","Welcome to Zenith Bank Site Upgrade Information","menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,menubar=no,width=310,height=420,left=400,top=600");
	window.open("http://wwww.zenithbank.com/thankyounigeria.cfm","","menubar=no,scrollbars=no,resizable=yes,location=no,status=no,menubar=no,width=310,height=420,left=400,top=500");
}

function openNewWindow(link,file){
	window.open(file,link.title,"menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,menubar=no,width=520,height=650,left=10,top=10");
}
function openNewWindowIbank(link,file){
	window.open(file,link.title,"menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,menubar=no,width=800,height=400,left=10,top=10");
}
function showDetails(person,details){
	var person = document.getElementById(person);
	var details = document.getElementById(details);
	hideAll();
	show2(person);
	show(details);
}
function showDetailsCard(card,details){
	var card = document.getElementById(card);
	var details = document.getElementById(details);
	hideAllCards();
	show2(card);
	show(details);
}
function showDetailsTelMobileBanking(comtype,details){
	var comtype = document.getElementById(comtype);
	var details = document.getElementById(details);
	hideAllTelMobileBanking();
	show2(comtype);
	show(details);
}
function showDetailsInternetBanking(details){
	var details = document.getElementById(details);
	hideAllInternetBanking();
	show(details);
}
function show(obj){
	
	obj.style.display='block';
}
function show2(obj){
	obj.style.backgroundColor='#cccccc';
}
function showAnswer(answerId){
	document.getElementById(answerId).style.display='block';
}
function hideAnswer(answerId){
	document.getElementById(answerId).style.display='none';
}
function hideAll(){
	var person = document.getElementById('jo');
	var details = document.getElementById('jo1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('ge');
	details = document.getElementById('ge1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('pa');
	details = document.getElementById('pa1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	/*person = document.getElementById('db');
	details = document.getElementById('db1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';*/
	
	person = document.getElementById('eia');
	details = document.getElementById('eia1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('ai');
	details = document.getElementById('ai1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('au');
	details = document.getElementById('au1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('py');
	details = document.getElementById('py1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	person = document.getElementById('ue');
	details = document.getElementById('ue1');
	person.style.backgroundColor='#ffffff';
	details.style.display='none';
}
function hideAllCards(){
	var card = document.getElementById('visacreditcardb');
	var details = document.getElementById('visacreditcard');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	card = document.getElementById('visadebitcardb');
	details = document.getElementById('visadebitcard');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	card = document.getElementById('eazycardb');
	details = document.getElementById('eazycard');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	card = document.getElementById('visaprepaidcardb');
	details = document.getElementById('visaprepaidcard');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';

	card = document.getElementById('ezwichb');
	details = document.getElementById('ezwich');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';

	card = document.getElementById('platinumcardb');
	details = document.getElementById('platinumcard');
	card.style.backgroundColor='#ffffff';
	details.style.display='none';

}
function hideAllTelMobileBanking(){
	var commtype = document.getElementById('telephonebankingb');
	var details = document.getElementById('telephonebanking');
	commtype.style.backgroundColor='#ffffff';
	details.style.display='none';
	
	commtype = document.getElementById('mobilebankingb');
	details = document.getElementById('mobilebanking');
	commtype.style.backgroundColor='#ffffff';
	details.style.display='none';
}
function hideAllInternetBanking(){
	//var topic = document.getElementById('benefits');
	var details = document.getElementById('benefits');
	//commtype.style.backgroundColor='#ffffff';
	details.style.display='none';
	var details = document.getElementById('faqs');
	details.style.display='none';
	var details = document.getElementById('ib');
	details.style.display='none';
}
function makeHeightEqual(obj1name,obj2name){
	var obj1 = document.getElementById(obj1name);
	var obj2 = document.getElementById(obj2name);
	alert(obj1.style.height);
	obj2.style.height=obj1.style.height;
}
function clearMenuBarBorder(menubar,color){
	var obj1 = document.getElementById(menubar);
	obj1.style.borderColor=color;
	obj1.style.borderWidth='0px';
}
function unClearMenuBarBorder(menubar,color){
	var obj1 = document.getElementById(menubar);
	obj1.style.borderColor=color;
	obj1.style.borderWidth='1px';
}

function pause(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
} 
