

function popitup(url)
{
    centeredWin=window.open(url,'name','height=560,width=550,resizable,scrollbars');
    if (window.focus) {centeredWin.focus()}
    return false;
}

function popitupwide(url)
{
    centeredWin=window.open(url,'name','height=600,width=650,resizable,scrollbars');
    if (window.focus) {centeredWin.focus()}
    return false;
}

var str_windowURL="";
var str_windowName="";
var int_windowWidth="";
var int_windowHeight="";
var bool_scrollbars="";
var bool_resizable="";
var bool_menubar="";
var bool_toolbar="";
var bool_addressbar="";
var bool_statusbar="";
var bool_fullscreen="";

function centeredWin(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
    str_windowURL=a_str_windowURL;
    str_windowName=a_str_windowName;
    int_windowWidth=a_int_windowWidth;
    int_windowHeight=a_int_windowHeight;
    bool_scrollbars=a_bool_scrollbars;
    bool_resizable=a_bool_resizable;
    bool_menubar=a_bool_menubar;
    bool_toolbar=a_bool_toolbar;
    bool_addressbar=a_bool_addressbar;
    bool_statusbar=a_bool_statusbar;
    bool_fullscreen=a_bool_fullscreen;
    createXMLHttpRequest();
    xmlHttp.open("POST", "/jumpToLogin.ac", true);
    xmlHttp.onreadystatechange = handleServerResponse4;
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
    xmlHttp.send(null);
 
}

function handleServerResponse4(){
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            var message = "";
            message = xmlHttp.responseXML.getElementsByTagName("message")[0].firstChild.data;
            if(message == "fail"){
                window.location="/login.ac";
            }
            else if(message == "success") {
                var int_windowLeft = (screen.width - int_windowWidth) / 2;
                var int_windowTop = (screen.height - int_windowHeight) / 2;
                var str_windowProperties = 'height=' + int_windowHeight + ',width=' + int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + bool_scrollbars + ',resizable=' + bool_resizable + ',menubar=' + bool_menubar + ',toolbar=' + bool_toolbar + ',location=' + bool_addressbar + ',statusbar=' + bool_statusbar + ',fullscreen=' + bool_fullscreen + '';
                var obj_window = window.open(str_windowURL, str_windowName, str_windowProperties)
                if (parseInt(navigator.appVersion) >= 4) {
                    obj_window.window.focus();
                }
            }
        }
    }
}
  
function centeredWin2(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
    var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
    var int_windowTop = (screen.height - a_int_windowHeight) / 2;
    var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
    var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
        obj_window.window.focus();
    }
}







/*
function playDemo() {
	
    //centeredWin('\playDemo.jsp', 'palyDemo', 820, 620, 0, 0, 0, 0, 0, 0, 0);
    window.location="/signupnew.jsp";
	return false;
}
*/
function flash_signup() {
    window.location="/index.jsp";
    return false;
}

function flash_buyGift() {
    window.location="/buyGift.ac";
    return false;
}

function flash_goSplash() {
    window.location="/splash.jsp";
    return false;
}

function flash_playDemo() {
    /*$('mainFlash').hide();
    $('flashPlayerCKDiv').hide();
    new Ajax.Updater('flashPlayerCKDiv', '/blank.jsp');
    new Ajax.Updater('demoIntroDiv', '/playDemoFragment.jsp');
    $('demoIntroDiv').show();
    return false;*/
    showDemo();
}
function playDemo(){
	if ($('mainFlash')!= null)
    {
        $('mainFlash').hide();
    }
	//new Ajax.Updater('demoIntroDiv', 'demo.jsp');
	new Ajax.Updater('demoIntroDiv', '/demo.jsp',{evalScripts:true});
    $('demoIntroDiv').show();
    return false;
}


function showSignUpDetail(detailId){

    new Ajax.Updater('SignUpDetailDiv', '/choosePackageMore.jsp?selectOption='+detailId);
    $('SignUpDetailDiv').show();
    $('SignUpDetailDiv').style.top=fGetXY($('signupmoretd'+detailId)).y+'px';
	$('SignUpDetailDiv').style.left=fGetXY($('signupmoretd'+detailId)).x-20+"px";
	
    return false;
}
function closeSignUpDetail() {
    $('SignUpDetailDiv').hide();
    new Ajax.Updater('SignUpDetailDiv', '/blank.jsp');
}

function CloseDemo(){
	 if ($('mainFlash')!= null)
    {
        $('mainFlash').show();
    }
    if ($('demoIntroDiv')!= null)
    {
	 new Ajax.Updater('demoIntroDiv', '/blank.jsp');
	 $('demoIntroDiv').hide();
	}
	 closeAllFlashDiv();
}

function close_playDemo() {	
    closeAllFlashDiv();
}

function showDemo() {
    if ($('mainFlash')!= null)
    {
        $('mainFlash').hide();
    }
    if ($('demoIntroDiv')!= null)
    {
        $('demoIntroDiv').hide();
    }
    $('flashPlayerCKDiv').hide();
    new Ajax.Updater('flashPlayerCKDiv', '/blank.jsp');
    new Ajax.Updater('flashPlayerLessonDiv', '/demo/playDemo.jsp');
    $('flashPlayerLessonDiv').show();
    return false;
}

function playCultureShockerDemo(para) {
    hideFlashDiv();
    
    if (para != null)
    {
        new Ajax.Updater('flashPlayerCKDiv', '/playCultureShockerDemo.ac?'+para,{evalScripts:true});
    }else {
        new Ajax.Updater('flashPlayerCKDiv', '/playCultureShockerDemo.ac',{evalScripts:true});
    }

    $('flashPlayerCKDiv').show();
    return false;
}


function closeAllFlashDiv() {

    if ($('flashPlayerLessonDiv')!= null)
    {
        $('flashPlayerLessonDiv').hide();
        new Ajax.Updater('flashPlayerLessonDiv', '/blank.jsp');
    }
    if ($('flashPlayerCKDiv')!= null)
    {
        $('flashPlayerCKDiv').hide();
        new Ajax.Updater('flashPlayerCKDiv', '/blank.jsp');
    }
    if ($('mainFlash')!= null)
    {
        $('mainFlash').show();
    }
    if ($('myLesson')!= null)
    {
        $('myLesson').show();
    }
    if ($('currentDisplay')!= null)
    {
        $('currentDisplay').show();
    }

    return false;
}

function hideFlashDiv(){
	if ($('currentDisplay')!= null)
    {
        $('currentDisplay').hide();
    }
    if ($('myLesson')!= null)
    {
        $('myLesson').hide();
    }
    if ($('mainFlash')!= null)
    {
        $('mainFlash').hide();
    }
    if ($('demoIntroDiv')!= null)
    {
        $('demoIntroDiv').hide();
    }
    if ($('flashPlayerLessonDiv')!= null)
    {
        $('flashPlayerLessonDiv').hide();
        new Ajax.Updater('flashPlayerLessonDiv', '/blank.jsp');
    }
}

function CloseWin() {

    closeAllFlashDiv();
}

function closeWin() {
    closeAllFlashDiv();
}


/*
scrollbars, resizable, menubar, toolbar, addressbar, statusbar, fullscreen
*/


function saveAndExit(lessonId, segmentId,pointValue) {
    var xmlObj = null;
	if(pointValue==undefined){
		pointValue="0";
	}
   if(window.XMLHttpRequest){
       xmlObj = new XMLHttpRequest();
   } else if(window.ActiveXObject){
       xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
       return;
   }
   xmlObj.onreadystatechange = function(){
       if(xmlObj.readyState == 4 && xmlObj.status == 200){
	   		var result = xmlObj.responseXML.getElementsByTagName('result')[0].firstChild.data;
       }
   }
   var lessonKey = document.getElementById("lessonKey").value;
   var userId = document.getElementById("userId").value;
   xmlObj.open ('GET', document.getElementById("WebServerURL").value + 'saveUserLessonHistory.ac?lessonKey='+lessonKey+'&lessonSegmentId='+segmentId+'&pointValue='+pointValue+'&userId='+userId, true);
   xmlObj.send (null);
}


//show flash object when load finish
function flash_loadOK() {
	if ($('div_close')!= null)
    {
        $('div_close').hide();
        //$('div_close2').hide();
    }
    $('flashObj').width="800";
    $('flashObj').height="600";
    document.getElementsByTagName("embed")["flashObj_ff"].width="800";
    document.getElementsByTagName("embed")["flashObj_ff"].height="600";
}




function showCountriesDiv(){

    new Ajax.Updater('countriesDiv', '/dropDownCountries.jsp');
    $('countriesDiv').show();
    $('countriesDiv').style.top=fGetXY($('bestValue')).y+'px';
	$('countriesDiv').style.left=fGetXY($('bestValue')).x+100+"px";
    return false;
}
function closeCountriesDiv() {
    $('countriesDiv').hide();
    new Ajax.Updater('countriesDiv', '/blank.jsp');
}


function flash_freeTrial() {
    window.location="/freetrial.jsp";
    return false;
}

function flash_travelDemo() {
    window.location="/travel/demo.jsp";
    return false;
}
function flash_schoolDemo() {
    window.location="/school/demo.jsp";
    return false;
}

function flash_adultHome() {
    window.location="/home.jsp";
    return false;
}

function flash_kidsHome() {
    window.location="/learn-Chinese/kids/";
    return false;
}

function flash_schoolHome() {
    window.location="/learn-Chinese/school/";
    return false;
}

function flash_travelHome() {
    window.location="/learn-Chinese/travel/";
    return false;
}


function showChineseNameDiv(){
    new Ajax.Updater('chineseNameDiv', '/chineseName.jsp',{evalScripts:true});
    $('chineseNameDiv').show();
    //$('chineseNameDiv').style.top=fGetXY($('head_home')).y+'px';
	//$('chineseNameDiv').style.left=fGetXY($('head_home')).x+100+"px";
    $('chineseNameDiv').style.top="50px";
	$('chineseNameDiv').style.left="500px";
    return false;
}

function closeChineseNameDiv() {
    $('chineseNameDiv').hide();
    new Ajax.Updater('chineseNameDiv', '/blank.jsp');
}

function flash_schoolVideo() {
    window.location="/school/featuredSchools.jsp";
    return false;
}

function flash_holiday() {
    window.location="/holiday.jsp";
    return false;
}

function Flash_OlympicTutoring(){
	window.location="/callScheduleOlympic.ac";
  return false;
}


//editionCode: 1- professional, 2-school, 3-kids, 4-travel
function flash_playIntro(editionCode) {
	if ($('div_cg')!= null)
    {
        $('div_cg').hide();
    }
	new Ajax.Updater('div_playHome', '/playHome.jsp?id='+editionCode,{evalScripts:true});    
    $('div_playHome').show();
     var windowWidth, windowHeight,windowscrollTop;
    if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
    windowscrollTop = document.documentElement.scrollTop;
    } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
    windowscrollTop = document.body.scrollTop;
    }    
    var _top = Math.round((windowHeight-400)/2)+windowscrollTop ;
    var _left = Math.round((windowWidth-600)/2);
    $('div_playHome').style.top=_top+'px';
    $('div_playHome').style.left=_left+'px';
    cook.setCookie("com.activechinese.flashPlayIntro"+editionCode,"true");
    return false;
}
function flash_closeIntro(editionCode) {
	if ($('div_playHome')!= null)
  {
		$('div_playHome').hide();
		new Ajax.Updater('div_playHome', '/blank.jsp');
	}
	if ($('div_cg')!= null)
  {
     $('div_cg').show();
  }
  cook.setCookie("com.activechinese.flashPlayIntro"+editionCode,"false");
}

//editionCode: 1- professional, 2-school, 3-kids, 4-travel
function Flash_acLogin(editionCode) {
	/*
	if (editionCode == null)
	{
		window.location="/acLogin.jsp";
	}else {
	    window.location="/acLogin.jsp?editionCode=" + editionCode;
	}
	*/
	window.location="/login.jsp";
    return false;
}

function kidsfileView(fileType){
	
	window.location = "/kids/fileView.kz?filetype="+fileType;

}



//menu: 1-Professionals,2-Students,3-Travelers,4-K12,5-Colleges,6-Language Schools,7-Home Schooling,
//		8-Self-Study,9-FCC,10-Business,11-Non-profits,12-Government,13-Travel Agencies
function Flash_HomeMenu(menu) {	
	var cm1 = "1";
	var cm2 = menu;
	if(menu == "4" || menu == "5" || menu == "6"){
		cm1 = "2";	
	}else 	if(menu == "7" || menu == "8" || menu == "9"){
		cm1 = "3";	
	}else 	if(menu == "10" || menu == "11" || menu == "12" || menu == "13"){
		cm1 = "4";	
	}
	if (menu == "11" || menu == "12")
	{
		menu = "10";
	}else if (menu == "13")
	{
		menu = "11";
	}
	window.location = "/home"+menu+".jsp?cm1="+cm1+"&cm2="+cm2+"";
}

//editionCode: help_school,help_kids
function HelpStartedIntro(editionCode) {
		if ($('helpStartedDiv')!= null)    	{
        $('helpStartedDiv').hide();
    }
		new Ajax.Updater('div_playHome', '/playHome.jsp?id='+editionCode,{evalScripts:true});    
    $('div_playHome').show();
     var windowWidth, windowHeight,windowscrollTop;
    if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
    windowscrollTop = document.documentElement.scrollTop;
    } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
    windowscrollTop = document.body.scrollTop;
    }    
    var _top = Math.round((windowHeight-400)/2)+windowscrollTop ;
    var _left = Math.round((windowWidth-600)/2);
    $('div_playHome').style.top=_top+'px';
    $('div_playHome').style.left=_left+'px';
    
    return false;
}
function HelpStartedIntro_close() {
  if ($('myLesson')!= null)
	{
		$('myLesson').show();
	}
	if ($('div_flashObj')!= null)
	{
		$('div_flashObj').show();
	}
  if ($('div_playHome')!= null)
  {
		$('div_playHome').hide();
		new Ajax.Updater('div_playHome', '/blank.jsp');
	}
}

function duplicatedLoginCheck(){
	//commitFlag = true;
	//showLoad();
	var url = "/duplicatedLogin.ac";
	var postData = null; 
	var myAjax = new Ajax.Request(url,{method: 'get', parameters: postData, onComplete: duplicatedLoginReturn});
}
function duplicatedLoginReturn(rt) {
    //commitFlag = false;
	//unshowLoad();	
    var result = rt.responseText;
    if (result == "duplicatedLogin") {
        window.location = "/duplicatedLogin.jsp";
	}
}

/** play lesson ---------------------------------------------------------------------------------------------------**/

function lessonPlayWin(a_str_windowURL, a_str_windowName) {
	duplicatedLoginCheck();
    if ($('myLesson')!= null)
    {
        $('myLesson').hide();
    }

    if (BrowserDetect.OS == 'Mac')
    {
        a_str_windowURL = "member/playLessonMac.jsp?" + a_str_windowURL;
    }else {
        a_str_windowURL = "member/playLesson.jsp?" + a_str_windowURL;
    }
    new Ajax.Updater('flashPlayerLessonDiv', a_str_windowURL,{evalScripts:true});

    $('flashPlayerLessonDiv').show();
   
    var windowWidth, windowHeight,windowscrollTop;
    var _top,_left;
    var ua = navigator.userAgent;
    if (ua.indexOf("Safari")>0) { // Safari    	
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;    
    windowscrollTop = document.body.scrollTop;
    
    _top = windowscrollTop ;
    _left = Math.round((windowWidth-800)/2);
    }
    else { // IE,Firefox
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
    windowscrollTop = document.documentElement.scrollTop;
    _top = Math.round((windowHeight-600)/2)+windowscrollTop ;
    _left = Math.round((windowWidth-800)/2);
    } 
    
    $('flashPlayerLessonDiv').style.top=_top+'px';
    $('flashPlayerLessonDiv').style.left=_left+'px';

    return false;

}


function playCultureShocker(para) {
	duplicatedLoginCheck();
	hideFlashDiv();
    
    if (para != null)
    {
        new Ajax.Updater('flashPlayerCKDiv', '/playCultureShocker.do?'+para,{evalScripts:true});
    }else {
        new Ajax.Updater('flashPlayerCKDiv', '/playCultureShocker.do',{evalScripts:true});
    }

    $('flashPlayerCKDiv').show();
    return false;
}

function playSchoolLesson(a_str_windowURL) {
	duplicatedLoginCheck();
    if ($('myLesson')!= null)
    {
        $('myLesson').hide();
    }

    
    if (BrowserDetect.OS == 'Mac')
    {
        a_str_windowURL = "playLessonMac.jsp?" + a_str_windowURL;
    }else {
        a_str_windowURL = "playLesson.jsp?" + a_str_windowURL;
    }

    new Ajax.Updater('div_playLesson', a_str_windowURL,{evalScripts:true});    
    $('div_playLesson').show();
    var windowWidth, windowHeight,windowscrollTop;
    if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
        windowscrollTop = document.documentElement.scrollTop;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
        windowscrollTop = document.body.scrollTop;
    }
    
    var _top = Math.round((windowHeight-600)/2)+windowscrollTop ;
    var _left = Math.round((windowWidth-800)/2);
    $('div_playLesson').style.top=_top+'px';
    $('div_playLesson').style.left=_left+'px';
    return false;
}

function closePlaySchool(){
    $('div_playLesson').hide();
    new Ajax.Updater('div_playLesson', './blank.jsp');

    if ($('myLesson')!= null)
    {
        $('myLesson').show();
    }
}
function playSchoolCultureShocker(para) {
	duplicatedLoginCheck();
	hideFlashDiv();
    
    if (para != null)
    {
        new Ajax.Updater('flashPlayerCKDiv', '/school/playCultureShocker.do?'+para,{evalScripts:true});
    }else {
        new Ajax.Updater('flashPlayerCKDiv', '/school/playCultureShocker.do',{evalScripts:true});
    }

    $('flashPlayerCKDiv').show();
    return false;
}

/** play lesson end ---------------------------------------------------------------------------------------------------**/

/** help ---------- ---------------------------------------------------------------------------------------------------**/
function playHelpStarted(){
	new Ajax.Updater('helpStartedDiv', '/help_pro.jsp');
    $('helpStartedDiv').show();
    
    $('helpStartedDiv').style.top=320+'px';
	$('helpStartedDiv').style.left=fGetXY($('helpstartedtd')).x-540+"px";
	
    cook.setCookie("com.activechinese.helpstarted","true");
    return false;
}
function close_helpStarted() {

	if ($('myLesson')!= null)
	{
		$('myLesson').show();
	}

    $('helpStartedDiv').hide();
    new Ajax.Updater('helpStartedDiv', '/blank.jsp');
    cook.setCookie("com.activechinese.helpstarted","false");
    
}
function showHelpStarted_school(){
	if ($('myLesson')!= null)
	{
		$('myLesson').hide();
	}

	new Ajax.Updater('helpStartedDiv', '/school/helpStarted.jsp');
    $('helpStartedDiv').show();
	$('helpStartedDiv').style.top =fGetXY($('helpstartedtd')).y-25+"px";
	$('helpStartedDiv').style.left=fGetXY($('helpstartedtd')).x-195+"px";
	
    cook.setCookie("com.activechinese.school.helpstarted","true");
    return false;
}

function closeHelpStarted_school() {

	if ($('myLesson')!= null)
	{
		$('myLesson').show();
	}

    $('helpStartedDiv').hide();
    new Ajax.Updater('helpStartedDiv', '/blank.jsp');
    cook.setCookie("com.activechinese.school.helpstarted","false");
    
}

function showHelpStarted_kids(){
	new Ajax.Updater('helpStartedDiv', '/kids/helpStarted.jsp');
    $('helpStartedDiv').show();
	$('helpStartedDiv').style.top =fGetXY($('helpstartedtd')).y+5+"px";
	$('helpStartedDiv').style.left=fGetXY($('helpstartedtd')).x-102+"px";
	
    cook.setCookie("com.activechinese.kids.helpstarted","true");
    return false;
}

function closeHelpStarted_kids() {
    $('helpStartedDiv').hide();
    new Ajax.Updater('helpStartedDiv', '/blank.jsp');
    cook.setCookie("com.activechinese.kids.helpstarted","false");
    
}

/** help ---------- ---------------------------------------------------------------------------------------------------**/

function promoApply(){
	if (commitFlag) {
        return false;
    }
	var divErrMessage=document.getElementById("errMessage");
	divErrMessage.innerHTML="";
	if(document.register_form.promoCode.value.trim() == ""){
		divErrMessage.innerHTML='Please enter Promotion Code.<br/>';		 
		return false;
	} else {
		doAjax_promo();
	}
}
function doAjax_promo(){
	commitFlag = true;
	showLoad();
	var url = "/getValueForAjax.ac?code=PromoPrice";
	var postData = Form.serialize("register_form"); 
	var myAjax = new Ajax.Request(url,{method: 'get', parameters: postData, onComplete: handleServerResponse_promo});
		
}
function handleServerResponse_promo(originalRequest) {
    commitFlag = false;
	unshowLoad();
    var result = originalRequest.responseText.split("#");
    var msg1 = result[0];
    var msg2 = result[1];
    if (msg1 == "diff") {
		$('span_price').innerHTML = msg2;    
    }else{
		$('errMessage').innerHTML = "We're sorry,but we didn't recognize the promotional claim code or gift certificate/card code you entered.<br/>";
	}
}

function forwardPay() {
    window.location = "/pro/choosePackage.jsp";
}

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 getFlashVer() {
        var f="",n=navigator; 
        if (n.plugins && n.plugins.length) {
                for (var ii=0;ii<n.plugins.length;ii++) {
                        if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
                                f=n.plugins[ii].description.split('Shockwave Flash ')[1];
                                break;
                        }
                }
        } else if (window.ActiveXObject) {
                for (var ii=10;ii>=2;ii--) {
                        try {   
                                var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
                                if (fl) {f=ii + '.0'; break; }
                                }
                        catch(e) {}
                }
        }
        return f;
}

