window.onload = attachFormHandlers;
function attachFormHandlers()
{
if( document.getElementById &&
      document.getElementsByTagName ){
    if( document.getElementById('iselect-sf1-form') ){	  
    var objForm = document.getElementById('iselect-sf1-form');
      objForm.onsubmit = function(){return checkForm(this);}}
  }
}
function checkForm(val){
	document.getElementById('iselect-sf1-form').EventId.value = val;
	if (document.getElementById('iselect-sf1-form').membershipType.value == -1){
		alert('Please choose membership');
		document.getElementById('iselect-sf1-form').membershipType.focus();
		return false;
	}
	else {
	document.getElementById('iselect-sf1-form').submit();
	}
}
function clearCookieAndLogout(){
	Set_Cookie("custId",null,null,"/");
	Set_Cookie("ref",null,null,"/");
	Set_Cookie("isDirected",null,null,"/");
	Set_Cookie("lastSession",null,null,"/");
	Set_Cookie("resultsShown",null,null,"/");
	Set_Cookie("referringUrl",null,null,"/");
	Set_Cookie("trackerKey",null,null,"/");
	Set_Cookie("pageSequence",null,null,"/");
	Set_Cookie("trackingId",null,null,"/");
	window.document.location = "/cds/pages/logout.action";	
}
function showDate(){
	var months=new Array(13);
	months[1]="January";
	months[2]="February";
	months[3]="March";
	months[4]="April";
	months[5]="May";
	months[6]="June";
	months[7]="July";
	months[8]="August";
	months[9]="September";
	months[10]="October";
	months[11]="November";
	months[12]="December";
	var time=new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)
	year = year + 1900;
	document.write("" + lmonth + " ");
	document.write(date + ", " + year + "");
}
var choice = "1234567890abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXTZ";
var size_of_password = 20;
var trackingId = '';
for (var i=0; i<size_of_password; i++) {
  var rnd = Math.floor(Math.random() * choice.length);
  trackingId += choice.substring(rnd,rnd+1);
}
var today = new Date();
var expires = new Date(today.getTime() + (3600000));
trackingId = ''+ trackingId + today.getTime();
function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
function Get_Cookie(name) {
	alert('get called');
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
var tid = Get_Cookie("trackingId");
if (tid == null){
	Set_Cookie("trackingId",trackingId,expires,"/");
}
function trackRecord(action){
	var tid = Get_Cookie("trackingId");
	var referringUrl = Get_Cookie("referringUrl");
	var incomingUrl = Get_Cookie("incomingUrl");
	var submitQuery = 'action='+action+'&trackingId='+Get_Cookie("trackingId")+'&referringUrl='+Get_Cookie("referringUrl")+'&incomingUrl='+Get_Cookie("incomingUrl");
	var queryString = 'http://'+ window.document.domain + '/cds/servlet/IncomingTracker?'+submitQuery;
	imageIR = new Image();
	imageIR.src = queryString;
}
var choice = "1234567890abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXTZ";
var size_of_password = 20;
var trackerKey = '';
for (var i=0; i<size_of_password; i++) {
  var rnd = Math.floor(Math.random() * choice.length);
  trackerKey += choice.substring(rnd,rnd+1);
}
var today = new Date();
var expires = new Date(today.getTime() + (3600000));
var loginCookieExpiry = new Date(today.getTime() + (180*24*60*60*1000));
trackerKey = ''+ trackerKey + today.getTime();
function randomString(string_length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;	
}
function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
var tid = Get_Cookie("trackerKey");
if (tid == null || tid == 'null'){
	Set_Cookie("trackerKey",trackerKey,null,"/");
}
var seq = Get_Cookie("pageSequence");
if (seq == null || seq == 'null'){
	var one = parseInt('1');
	Set_Cookie("pageSequence",one,null,"/");
}
else{
	var next = parseInt(seq) + 1;
	Set_Cookie("pageSequence",next,null,"/");
}
function trackPage(pageId){
	var tid = Get_Cookie("trackingId");
	var referringUrl = Get_Cookie("referringUrl");
	var incomingUrl = Get_Cookie("incomingUrl");
	var submitQuery = 'pageId='+pageId+'&trackingId='+Get_Cookie("trackerKey")+'&seq='+Get_Cookie("pageSequence")+'&time='+today.getTime();
	var queryString = 'http://'+ window.document.domain + '/cds/servlet/PageTracker?'+submitQuery;
	imageIR = new Image();
	imageIR.src = queryString;
}
function trackData(key, value){
	var submitQuery = 'key='+key+'&value='+value+'&time='+today.getTime();
	var queryString = 'http://'+ window.document.domain + '/cds/pages/datalog.action?'+submitQuery;
	imageIR = new Image();
	imageIR.src = queryString;
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function isDate (day,month,year) {
    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) )
        return true;
    else
        return false
}
function isDateyear(dt ) {
var date = new Date(dt)
var  date_year = date.getFullYear()+'';
dt_year = date_year.substring(0,2);
if( (dt_year.indexOf('19')!=-1) || (dt_year.indexOf('20')!=-1))
{
	return true;
}
else 
return false;
}
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}
var items = {
		"health_insurance_glossary.htm": "/health_insurance_glossary.htm",
		"health_insurance_iselect_about_us.htm": "/health_insurance_iselect_about_us.htm",
		"health_insurance_privacy_statement.htm": "/health_insurance_privacy_statement.htm",
		"health_insurance_faq.htm": "/health_insurance_faq.htm",
		"health_insurance_iselect_contact_us.htm": "/health_insurance_iselect_contact_us.htm",
		"best_price.htm": "/best_price.htm",
		"seven_top_tips_on_heatlhinsurance.html": "/seven_top_tips_on_heatlhinsurance.html",
		"free_health_insurance.htm": "/free_health_insurance.htm",
		"overseas_health_cover.html": "/overseas_health_cover.html",
		"switch_health_funds.html": "/switch_health_funds.html",
		"switch_health_funds.html?ref=9msn_tips&incoming=ninemsn": "/switch_health_funds.html",
		"iselect_ninemsn_media_release.htm": "/iselect_ninemsn_media_release.htm",
		"save_tax_on_health_insurance.html": "/save_tax_on_health_insurance.html",
		"health_insurance_fund_ahmg.htm": "/health_insurance_fund_ahmg.htm",
		"health_insurance_fund_australian_unity.htm": "/health_insurance_fund_australian_unity.htm",
		"health_insurance_fund_hcf.htm": "/health_insurance_fund_hcf.htm",
		"health_insurance_fund_mu.htm": "/health_insurance_fund_mu.htm",
		"health_insurance_fund_nib.htm": "/health_insurance_fund_nib.htm",
		"index.html": "/cds/pages/page_home.jsp",
		"index.jsp": "/cds/pages/page_home.jsp",
		"pregnancy_promotion.html": "/pregnancy_promotion.html",
		"davenkim.html": "/davenkim.html",
		"kerryanne.html": "/kerryanne.html"
		};
function divertTo9Msn(href){
	var temp = new Array();
	temp = href.split('/');
	document.location = items[temp[temp.length-1]];
}
var reloading = true;
function checkIfToDisableAncillary() {
   	if (document.myForm.searchType.value == 5){
   		if (document.myForm.policyType.length == 3){
			if (document.myForm.policyType.value == 'AncillaryOnly'){
				document.myForm.policyType.value = 'HospitalOnly';	
			}	
			document.myForm.policyType.options[1] = null;
		}
	}
	else{
		if (document.myForm.policyType.length < 3){
			for (var i = document.myForm.policyType.length;i > 0;i--)
		    		document.myForm.policyType.options[0] = null;
			opt('HospitalOnly', 'Hospital Cover', 'policyType');
			opt('AncillaryOnly', 'Extras Cover', 'policyType');
			opt('Both', 'Hospital & Extras Cover', 'policyType');
			reloading = true;
		}
	}
}
function registerAuOverseasCover(type){
	if (type == 1){
		var sel = document.myForm.searchType.value;
		if (sel == '6'){
			var auDate = new Date();
			trackData('AU_Overseas_Cover_IS',''+auDate.getTime());
			parent.location.href = '/au_overseas_cover.html';
		}
	}
	else{
		var auDate = new Date();
		trackData('AU_Overseas_Cover_IS',''+auDate.getTime());
		parent.location.href = '/au_overseas_cover.html';
	}
}
function registerAuOverseasCoverMembershipType(){
			var sel = document.myForm.membershipType.value;
			if(sel==7){
			var auDate = new Date();
						trackData('AU_Overseas_Cover_IS',''+auDate.getTime());
			parent.location.href = '/au_overseas_cover.html';
			
			}
			else if (sel==8){
			var auDate = new Date();
						trackData('AU_Overseas_Cover_IS',''+auDate.getTime());
			parent.location.href = '/health_insurance_aushealth.htm';
			}
}
function showHospitalCoverLinks() {
    opt('1', 'Hospital Cover', 'hospitalCover');
    if (searchType == 1 || searchType == 2 || searchType == 3 || searchType == 4) {
		opt('2', 'No Hospital Cover', 'hospitalCover');
    }
}
function showExcessLinks() {
	opt('Please Choose', 'Please Choose', 'ExcessValue');
	opt('0/0', '$0', 'ExcessValue');
	opt('1/250', '$1-$250', 'ExcessValue');
    if (whoFor == 0 || whoFor == 3 || whoFor == 4 || whoFor == 5 || whoFor == 6) {
		opt('251/500', '$251-$500', 'ExcessValue');
		opt('501/1000', '$501-$1000', 'ExcessValue');
		opt('1001/5000', 'Over $1000', 'ExcessValue');
    }
    if (whoFor == 1 || whoFor == 2) {
		opt('251/500', '$251-$500', 'ExcessValue');
		opt('501/5000', 'Over $500', 'ExcessValue');
    }
	opt('0/5000', 'I will choose later', 'ExcessValue');
	if (whoFor == 3 || whoFor == 4 || whoFor == 5 || whoFor == 6) {
		document.myForm.ExcessValue.options[4].selected = true;
	}
	if (whoFor == 1 || whoFor == 2) {
		document.myForm.ExcessValue.options[3].selected = true;
	}
}
function opt(href,text, elementName) {
    if (reloading)  {
        var optionName = new Option(text, href, false, false)
		var length = document.myForm.elements[elementName].length;
        document.myForm.elements[elementName].options[length] = optionName;
    }
    else
        document.write('<OPTION VALUE="',href,'">',text,'<\/OPTION>');
}
function submitThisForm(val){
	document.myForm.EventId.value = val;
	if (document.myForm.searchType.value == 5){ 	
		if (document.myForm.policyType.value == 'AncillaryOnly'){
			alert('\nTo avoid the government Medicare Levy Surcharge you need to take out a      \n\n    -Hospital or \n    -Hospital and Ancillary product\n\n See Glossary for more information.\n');
			return false;
		}
	}
	if (document.myForm.membershipType.value == -1){
		alert('Please choose membership');
		document.myForm.membershipType.focus();
		return false;
	}
	if (document.myForm.membershipType.value == 7 ){
			alert('Please choose valid membership');
			document.myForm.membershipType.focus();
			return false;
	}
	if (document.myForm.membershipType.value == 8 ){
			alert('Please choose valid membership');
			document.myForm.membershipType.focus();
			return false;
	}
	document.myForm.submit();
}
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
		'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings);
	win.focus();
}
function decideExcess(){
	if (document.myForm.hospitalCover.value == "2" && document.myForm.extrasCover.value == "1"){
		myForm.ExcessValue.disabled=true;
	}
	else{
		myForm.ExcessValue.disabled=false;
	}
}
var today = new Date();
var day = today.getDate();
var month = today.getMonth();
var year = today.getYear();
var monthnames = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var slideShowSpeed = 5000
var crossFadeDuration = 10
var Pic = new Array()
var j = 0
function submitLogin(val){
	document.form1.eventId.value = 'home_non_pop_up';
	if (document.form1.login.value == ''){
		alert('Please provide Email');
		document.form1.login.focus();
		return false;
	}
	if (document.form1.password.value == ''){
		alert('Please provide Password');
		document.form1.password.focus();
		return false;
	}
	document.form1.login.value = document.form1.login.value.toLowerCase();
	document.form1.submit();
}
function showHidePasswordDiv()
{
document.getElementById("passwordDiv1").style.display="none";
document.getElementById("passwordDiv2").style.display="block";
}
function clearValue()
{
document.form1.login.value="";
}
function OpenPopup (c) {
window.open(c,
'window',
'width=420,height=650,scrollbars=yes,status=yes');
}
function submitThisForm(val){
	if (document.myForm.membershipType.value == -1){
		alert('Please choose membership');
		document.myForm.membershipType.focus();
		return false;
	}
	document.myForm.submit();
}
function redirectCustomer(){
	ref = Get_Cookie("ref");
	if (ref == null || ref == ''){
		ref = 'pub';
	}
	custId = Get_Cookie("custId");
	custId = str_to_num(custId);
	rand0 = randomString(28);
	rand1 = randomString(30);
  	var br=new Array(4);
  	var os=new Array(2);
	br=getBrowser();
  	os=getOS();
   	browserType=br[0];
  	osType=os[0] +' '+os[1];
	if (custId != null && custId != ''){
		location.href="/cds/pages/mailredirect.action?id=" + rand0 + custId + "Y" + rand1 + "&type=auto&ref="+ref+"&browserType="+browserType+"&osType="+osType+"&url="+window.location;
	}
}
function str_to_num(str) {
	num_out = "";
	if(str != ""){
		str_in = escape(str);
		for(i = 0; i < str_in.length; i++) {
			num_out += str_in.charCodeAt(i) - 23;
		}
	}
	return num_out;
}
function num_to_str(str) {
	str_out = "";
	if(str != ""){
		num_out = str;
		for(i = 0; i < num_out.length; i += 2) {
			num_in = parseInt(num_out.substr(i,[2])) + 23;
			num_in = unescape('%' + num_in.toString(16));
			str_out += num_in;
		}
   }
   return unescape(str_out);
}
function getBrowser(obj) {
    var b=new Array("unknown", "unknown", "unknown", "unknown");
    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);
    if (brs.search(/omniweb[\/\s]v?(\d+([\.-]\d)*)/) != -1) {
        b[0]="omniweb";
        b[1]=brs.match(/omniweb[\/\s]v?(\d+([\.-]\d)*)/)[1];
        (b[1] > 4.5 ? b[2]="khtml" : b[2]="omniweb");
        (brs.search(/omniweb[\/\s]((\d+([\.-]\d)*)-)?v(\d+([\.-]\d)*)/) == -1 ?       b[3]=brs.match(/omniweb[\/\s](\d+([\.-]\d)*)/)[1] :        b[3]=brs.match(/omniweb[\/\s]((\d+([\.-]\d)*)-)?v(\d+([\.-]\d)*)/)[4]);
        return b;
    } else if (brs.search(/opera[\/\s](\d+(\.?\d)*)/) != -1) {
        b[0]="opera";
        b[1]=brs.match(/opera[\/\s](\d+(\.?\d)*)/)[1];
        b[2]="opera";
        b[3]=b[1];
        return b;
    } else if (brs.search(/crazy\s?browser\s(\d+(\.?\d)*)/) != -1) {
        b[0]="crazy";
        b[1]=brs.match(/crazy\s?browser\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/myie2/) != -1) {
        b[0]="myie2";
        b[2]="msie";
        b[3]=brs.match(/msie\s(\d+(\.?\d)*)/)[1];
        return b;
    } else if (brs.search(/netcaptor/) != -1) {
        b[0]="netcaptor";
        b[1]=brs.match(/netcaptor\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/avant\sbrowser/) != -1) {
        b[0]="avantbrowser";
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/msn\s(\d+(\.?\d)*)/) != -1) {
        b[0]="msn";
        b[1]=brs.match(/msn\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/msie\s(\d+(\.?\d)*)/) != -1) {
        b[0]="msie";
        b[1]=getMSIEVersion();
        b[2]="msie";
        b[3]=b[1];
        return b;
    } else if (brs.search(/powermarks\/(\d+(\.?\d)*)/) != -1) {
        b[0]="powermarks";
        b[1]=brs.match(/powermarks\/(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        try {
            b[3]=getMSIEVersion();
        } catch (e) { }
        return b;
} else if (brs.search(/konqueror[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="konqueror";
        b[1]=brs.match(/konqueror[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="khtml";
        return b;
    } else if (brs.search(/safari\/(\d)*/) != -1) {
        b[0]="safari";
        b[1]=brs.match(/safari\/(\d+(\.?\d*)*)/)[1];
        b[2]="khtml";
        b[3]=brs.match(/applewebkit\/(\d+(\.?\d*)*)/)[1];
        return b;
    } else if(brs.search(/zyborg/) != -1) {
        b[0]="zyborg";
        b[1]=brs.match(/zyborg\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if (brs.search(/netscape6[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="netscape";
        b[1]=brs.match(/netscape6[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/netscape\/(7\.\d*)/) != -1) {
        b[0]="netscape";
        b[1]=brs.match(/netscape\/(7\.\d*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/galeon[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="galeon";
        b[1]=brs.match(/galeon[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/nautilus[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="nautilus";
        b[1]=brs.match(/nautilus[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/firefox[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="firefox";
        b[1]=brs.match(/firefox[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/k-meleon[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="kmeleon";
        b[1]=brs.match(/k-meleon[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/firebird[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="firebird";
        b[1]=brs.match(/firebird[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/phoenix[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="phoenix";
        b[1]=brs.match(/phoenix[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/camino[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="camino";
        b[1]=brs.match(/camino[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/epiphany[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="epiphany";
        b[1]=brs.match(/epiphany[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/chimera[\/\s](\d+([\.-]\d)*)/) != -1) {
        b[0]="chimera";
        b[1]=brs.match(/chimera[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/icab[\s\/]?(\d+(\.?\d)*)/) !=-1) {
        b[0]="icab";
        b[1]=brs.match(/icab[\s\/]?(\d+(\.?\d)*)/)[1];
        b[2]="icab";
        b[3]=b[1];
        return b;
    } else if (brs.search(/netfront\/(\d+([\._]\d)*)/) != -1) {
        b[0]="netfront";
        b[1]=brs.match(/netfront\/(\d+([\._]\d)*)/)[1];
        b[2]="netfront";
        b[3]=b[1];
        return b;
    } else if (brs.search(/netscape4\/(\d+([\.-]\d)*)/) != -1) {
        b[0]="netscape";
        b[1]=brs.match(/netscape4\/(\d+([\.-]\d)*)/)[1];
        b[2]="mozold";
        b[3]=b[1];
        return b;
    } else if ( (brs.search(/mozilla\/(4.\d*)/) != -1) && (brs.search(/msie\s(\d+(\.?\d)*)/) == -1) ) {
        b[0]="netscape";
        b[1]=brs.match(/mozilla\/(4.\d*)/)[1];
        b[2]="mozold";
        b[3]=b[1];
        return b;
    } else if ((brs.search(/mozilla\/5.0/) != -1) && (brs.search(/gecko\//) != -1)) {
        b[0]="mozsea";
        b[1]=brs.match(/rv\x3a(\d+(\.?\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/elinks/) != -1) {
        b[0]="elinks";
        (brs.search(/elinks\/(\d+(\.?\d)*)/) == -1 ?
b[1]=brs.match(/elinks\s\x28(\d+(\.?\d)*)/)[1] :
b[1]=brs.match(/elinks\/(\d+(\.?\d)*)/)[1]);
        b[2]="elinks";
        b[3]=b[1];
        return b;
    } else if (brs.search(/w3m\/(\d+(\.?\d)*)/) != -1) {
        b[0]="w3m"
        b[1]=brs.match(/(^w3m|\sw3m)\/(\d+(\.?\d)*)/)[2];
        b[2]="w3m";
        b[3]=b[1];
        return b;
    } else if (brs.search(/links/) != -1) {
        b[0]="links";
        (brs.search(/links\/(\d+(\.?\d)*)/) == -1 ? b[1]=brs.match(/links\s\x28(\d+(\.?\d)*)/)[1] : b[1]=brs.match(/links\/(\d+(\.?\d)*)/)[1]);
        b[2]="links";
        b[3]=b[1];
        return b;
    } else if (brs.search(/java[\/\s]?(\d+([\._]\d)*)/) != -1) {
        b[0]="java";
        b[1]=brs.match(/java[\/\s]?(\d+([\._]\d)*)/)[1];
        b[2]="java";
        b[3]=b[1];
        return b;
    } else if(brs.search(/lynx/) != -1) {
        b[0]="lynx";
        b[1]=brs.match(/lynx\/(\d+(\.?\d)*)/)[1];
        b[2]="libwww-fm";
        b[3]=brs.match(/libwww-fm\/(\d+(\.?\d)*)/)[1];
        return b;
    } else if(brs.search(/dillo/) != -1) {
        b[0]="dillo";
        b[1]=brs.match(/dillo\s*\/*(\d+(\.?\d)*)/)[1];
        b[2]="dillo";
        b[3]=b[1];
        return b;
    } else if(brs.search(/wget/) != -1) {
        b[0]="wget";
        b[1]=brs.match(/wget\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/googlebot\-image/) != -1) {
        b[0]="googlebotimg";
        b[1]=brs.match(/googlebot\-image\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/googlebot/) != -1) {
        b[0]="googlebot";
        b[1]=brs.match(/googlebot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/msnbot/) != -1) {
        b[0]="msnbot";
        b[1]=brs.match(/msnbot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/turnitinbot/) != -1) {
        b[0]="turnitinbot";
        b[1]=brs.match(/turnitinbot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else {
        b[0]="unknown";
        return b;
    }
}
function getMajorVersion(v) {
    return (isEmpty(v) ? -1 : (hasDot(v) ? v : v.match(/(\d*)(\.\d*)*/)[1]))
}
function getMinorVersion(v) {
    return (!isEmpty(v) ? (!hasDot(v) ? v.match(/\.(\d*([-\.]\d*)*)/)[1] : 0) :
-1)
}
function getOS(obj) {
    var os=new Array("unknown", "unknown");
    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);
    if (brs.search(/windows\sce/) != -1) {
        os[0]="wince";
        try {
            os[1]=brs.match(/windows\sce\/(\d+(\.?\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/windows/) !=-1) || ((brs.search(/win9\d{1}/) !=-1))
) {
        os[0]="win";
        if (brs.search(/nt\s5\.1/) != -1) {
            os[1]="xp";
        } else if (brs.search(/nt\s5\.0/) != -1) {
            os[1]="2000";
        } else if ( (brs.search(/win98/) != -1) || (brs.search(/windows\s98/)!=
-1 ) ) {
            os[1]="98";
        } else if (brs.search(/windows\sme/) != -1) {
            os[1]="me";
        } else if (brs.search(/nt\s5\.2/) != -1) {
            os[1]="win2k3";
        } else if ( (brs.search(/windows\s95/) != -1) || (brs.search(/win95/)!=
-1 ) ) {
            os[1]="95";
        } else if ( (brs.search(/nt\s4\.0/) != -1) || (brs.search(/nt4\.0/) ) !=
-1) {
            os[1]="nt4";
        }
        return os;
    } else if (brs.search(/linux/) !=-1) {
        os[0]="linux";
        try {
            os[1] = brs.match(/linux\s?(\d+(\.?\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/mac\sos\sx/) !=-1) {
        os[0]="macosx";
        return os;
    } else if (brs.search(/freebsd/) !=-1) {
        os[0]="freebsd";
        try {
            os[1] = brs.match(/freebsd\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/sunos/) !=-1) {
        os[0]="sunos";
        try {
            os[1]=brs.match(/sunos\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/irix/) !=-1) {
        os[0]="irix";
        try {
            os[1]=brs.match(/irix\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/openbsd/) !=-1) {
        os[0]="openbsd";
        try {
            os[1] = brs.match(/openbsd\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/macintosh/) !=-1) || (brs.search(/mac\x5fpowerpc/)
!= -1) ) {
        os[0]="macclassic";
        return os;
    } else if (brs.search(/os\/2/) !=-1) {
        os[0]="os2";
        try {
            os[1]=brs.match(/warp\s((\d(\.\d)*)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/openvms/) !=-1) {
        os[0]="openvms";
        try {
            os[1]=brs.match(/openvms\sv((\d(\.\d)*)*)/)[1];
        } catch (e)  { }
        return os;
    } else if ( (brs.search(/amigaos/) !=-1) || (brs.search(/amiga/) != -1) ) {
        os[0]="amigaos";
        try {
            os[1]=brs.match(/amigaos\s?(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/hurd/) !=-1) {
        os[0]="hurd";
        return os;
    } else if (brs.search(/hp\-ux/) != -1) {
        os[0]="hpux";
        try {
            os[1]=brs.match(/hp\-ux\sb\.[\/\s]?(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/unix/) !=-1) || (brs.search(/x11/) != -1 ) ) {
        os[0]="unix";
        return os;
    } else if (brs.search(/cygwin/) !=-1) {
        os[0]="cygwin";
        return os;
    } else if (brs.search(/java[\/\s]?(\d+([\._]\d)*)/) != -1) {
        os[0]="java";
        try {
            os[1]=brs.match(/java[\/\s]?(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/palmos/) != -1) {
        os[0]="palmos";
        return os;
    } else if (brs.search(/symbian\s?os\/(\d+([\._]\d)*)/) != -1) {
        os[0]="symbian";
        try {
            os[1]=brs.match(/symbian\s?os\/(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else {
        os[0]="unknown";
        return os;
    }
}
function getGeckoVersion() {
    return brs.match(/gecko\/([0-9]+)/)[1];
}
function getMSIEVersion() {
    return brs.match(/msie\s(\d+(\.?\d)*)/)[1];
}
function getFullUAString(obj) {
    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);
    return brs;
}
function hasFlashPlugin(obj) {
    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);
    var f=new Array("0", "0");
    var brwEng=getBrowser(obj)[2];
        if ( (brwEng=="gecko") || (brwEng="opera") || (brwEng="khtml") || (brwEng="mozold")) {
        if (navigator.plugins && navigator.plugins.length) {
            x = navigator.plugins["Shockwave Flash"];
            if (x) {
                f[0] = 2;
                if (x.description) {
                    y = x.description;
                    f[1] = y.charAt(y.indexOf('.')-1);
                }
            } else {
                f[0] = 1;
            }
            if (navigator.plugins["Shockwave Flash 2.0"]) {
                f[0] = 2;
                f[0] = 2;
            }
        } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
            x = navigator.mimeTypes['application/x-shockwave-flash'];
            if (x && x.enabledPlugin) {
                f[0] = 2;
            } else {
                f[0] = 1;
            }
        }
   return f;
  } else if (brwEng=="msie") {
       for(var i=7; i>0; i--) {
           try {
               var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
               f[1] = i;
               break;
           } catch(e) { }
       }
       if (f[1]>0) {
           f[0]=2
       } else {
           f[0]=1
       }
   return f;
   } else {
       f[0]=0;
       f[1]=0;
       return f;
   }
}
function isEmpty(input) {
    return (input==null || input =="")
}
function hasDot(input) {
    return (input.search(/\./) == -1)
}
