﻿// JScript File
function UBookMarkGENSITE()
{
    addBookmarkForBrowser('Gensite Portal','http://www.gensite.be')
}
function _Gensite_Announce(mItemid,mWindowWidth,mWindowHeight)
{
    try{
        _UWaitPanel_DIV_Show('Please wait while Loading the data...')
        doAjax('Ajax/_AJaxAdmin.aspx?Type=showann&w='+mWindowWidth+'&h='+mWindowHeight+'&Mode=&ItemID='+ mItemid +'&RND='+new Date(),'_ann_callback')    
    }catch(e){
        alert(e.message)
    }    
}
function _Gensite_Mail(mItemid,mItemType)
{
    _UGensiteSendEmail_DIV_Show('Please Input Email Address to Send the Content',mItemid,mItemType)    
}
function _Gensite_Stat(mItemid,mItemType,mMAX)
{
    try{
        _UWaitPanel_DIV_Show('Please wait while Loading the data...')
        _UShowStat_DIV_Close()
        doAjax('Ajax/_AJaxAdmin.aspx?Type=getstat&max='+mMAX+'&Mode=&ItemID='+ mItemid +'&TypeID='+mItemType+'&RND='+new Date(),'_Gensite_Statcallback')    
    }catch(e){
        alert(e.message)
    }    
}
function _Gensite_MouseUp(e)
{
}
function _Gensite_ValidateClose()
{
}
function _Gensite_Close()
{
}
function setHomePage()
        {
	        oHomePage.setHomePage('http://www.gensite.be/');
        }
		

function _signininfo_doadminfunc(mMainYN)
{
    try{
    var mTitle = (mMainYN=='Y')?'Website is working on (Maintenance)':'Website is (Running)'
    var mCaption = (mMainYN=='Y')?'Start Gensite':'Stop Gensite'
    _UWaitPanel_DIV_Show('<table width = "100%" class = "Subhead"><tr><td colspan = 2 align = center> '+mTitle+' </td></tr>'+
                         '<tr><td><br></td></tr><tr><td>Administrator</td><td><input style = "width:150px" type = text id = txtadmin /></td></tr>'+
                         '<tr><td>Password</td><td><input type = password id = txtadminpwd style = "width:150px" /></td></tr>'+
                         '<tr><td colspan = 2 align = center ><br><input type = button class = button value = "'+mCaption+'" onclick = "javascript:_signininfo_doadminfunc2()" />'+
                         '&nbsp;<input type = button class = button value = "Cancel" onclick = "javascript:_UWaitPanel_DIV_Close()" /></td></tr>'+
                         '</table>',false)
    }catch(e){
    alert(e.message)
    }
}
function _signininfo_doadminfunc2()
{
    if (document.getElementById('txtadmin').value == ''){        
        alert('Please input your administrator name')
        domyFocus(document.getElementById('txtadmin'))
        return
    }
    if (document.getElementById('txtadminpwd').value == ''){        
        alert('Please input your administrator password')
        domyFocus(document.getElementById('txtadminpwd'))
        return
    }
    var muser= escape(document.getElementById('txtadmin').value)
    var mpwd = escape(document.getElementById('txtadminpwd').value)
    try{
        doAjax('Ajax/_AJaxSignin.aspx?mUser='+muser+'&mPassword='+mpwd+'&adminyn=Y&RND='+new Date(),'_signininfo_doadminfunccalled')    
    }catch(e){
        alert(e.message)
    }    
}
function _signininfo_doadminfunccalled2()
{
    if (xmlhttp.readyState==4) { 
        if (xmlhttp.status==200) { 

            //put your code here.,xmlhttp.responseText will return what your response.write in page url
            var mreturn = xmlhttp.responseText
            var munexpecterror = 'Unexpected Error Occurred,Please contact Gensite administrator.'
            if (mreturn == '') {
                alert(munexpecterror)
            }else{
            switch (mreturn.substring(0,2))
            {
               case 'OK':
                    alert(mreturn.substring(2,mreturn.length))                                           
                    break;
               default:
                    alert(munexpecterror)
            }
            }
        }
    }
}
function _signininfo_doadminfunccalled()
{
    if (xmlhttp.readyState==4) { 
        if (xmlhttp.status==200) { 

            //put your code here.,xmlhttp.responseText will return what your response.write in page url
            var mreturn = xmlhttp.responseText
            var munexpecterror = 'Unexpected Error Occurred,Please contact Gensite administrator.'
            if (mreturn == '') {
                alert(munexpecterror)
            }else{
            switch (mreturn.substring(0,2))
            {
               case 'OK':
                    var muser= escape(document.getElementById('txtadmin').value)
                    var mpwd = escape(document.getElementById('txtadminpwd').value)
                    try{
                        doAjax('Ajax/_AJaxExecute.aspx?type=setmainyn&mUser='+muser+'&mPassword='+mpwd+'&RND='+new Date(),'_signininfo_doadminfunccalled2')    
                    }catch(e){
                        alert(e.message)
                    }    
                    break;
               case 'DS':
                    alert('Sorry but you account is disabled, Please contact Gensite administrator.')
                    break;
               case 'KO':
                    var mfailedcount = parseFloat(mreturn.substring(2,3))
                    var mfailederr
                    if (mfailedcount < 3){
                        mfailederr = 'Le mot de passe est incorrect. Veuillez retaper votre mot de passe en minuscules.\n'+
                                     'Het paswoord is foutief. Gelieve het terug in te brengen (in kleine letters).\n'+
                                     'The password is incorrect. Please retype you password in lower case.'
                    }else{
                        mfailederr = 'Vous avez encodé à trios reprises un nom d’utilisateur ou un mot de passé incorrect. Veuillez prendre contact avec Generali afin d’obtenir un nom d’utilisateur et un mot de passe valide.'
                    }
                    alert(mfailederr)
                    break;
               case 'NO':
                    alert('Sorry but there is no Infomation about this User, Please contact Gensite administrator.')
                    break;
               case 'ER':
                    break;
               default:
                    alert(munexpecterror)
            }
            }
        }
    }
}
