/////////// check email error message
function loginerror() {document.getElementById('user').style.borderColor="#FF0000";}
/////////// check email
function emailCheck (emailStr) {
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
var msg="This email address does not seem to be valid.";
if (matchArray==null) {alert(msg); loginerror(); return false;}
var user=matchArray[1];var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {alert(msg); loginerror(); return false;}}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {alert(msg); loginerror(); return false;}}
if (user.match(userPat)==null) {alert(msg); loginerror(); return false;}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {alert(msg); loginerror(); return false;}}
return true;}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {alert(msg); loginerror(); return false;}}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {alert(msg); loginerror(); return false;}
if (len<2) {alert(msg); loginerror(); return false;}
return true;}
/////////// check email
///////// pop up
function Open(url,nom,details) {window.open(url,nom,details)}
/// wizard_signup
function wizard_signup()
{window.open("http://www.trvprotect.com/registration_wizard/", "wizard_signup", "toolbar=no, status=yes, scrollbars=yes, resizable=yes, width=800, height=600");}
/// login error
function message_login()
{alert('Reports available following registration');}
// sc wizard reg show next
function nexthome()
{document.getElementById('homediv1').style.display="none";document.getElementById('homediv2').style.display="block";}
function nextbus()
{document.getElementById('busdiv1').style.display="none";document.getElementById('busdiv2').style.display="block";}
function nextres()
{document.getElementById('resdiv1').style.display="none";document.getElementById('resdiv2').style.display="block";}
// sc logon userid/pass
function CheckTheForm() {var result = true; var msg=""; 
if (document.securitycenter.user.value=="") 
{msg+="Please enter your User ID! \n"; document.getElementById('user').style.borderColor="#FF0000"; result = false;} 
if (document.securitycenter.pass.value=="") 
{msg+="Please enter your password! \n"; document.getElementById('pass').style.borderColor="#FF0000"; result = false; } 
if(msg==""){ 
return result; 
}{ 
alert(msg) 
return result; 
}} 
/// show div (uc) login
function showLogin(obj)
{var el = document.getElementById(obj);
if(el.style.display != "block") {el.style.display = "block";}
else {el.style.display = "none";}}
// 
// MM preload Mx
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// MM
// Excel Create Object
function CreateExcelSheet()
{
var x=expcsv.rows
var xls = new Server.CreateObject("Excel.Application")
xls.visible = true
xls.Workbooks.Add
for (i = 0; i < x.length; i++)
{
var y = x[i].cells
for (j = 0; j < y.length; j++)
{
xls.Cells( i+1, j+1).Value = y[j].innerText
}
}
}
// Excel
// WindowStatus
function hidestatus(){
window.status='TRVProtect Hosted Antivirus Service'
return true
}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT | Event.MOUSEDOWN)
document.onmouseover=hidestatus
document.onmouseout=hidestatus
document.onmousedown=hidestatus
// WindowStatus
// limit text textarea
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
// limit text textarea
// change text (activation)
function changetext() {if(document.all){document.getElementById('1').innerText = "Please wait, your file will be generated in a few seconds";} else{document.getElementById('1').textContent = "Please wait, your file will be generated in a few seconds";}}
// change text (activation)


// helpdesk 
/////////// check help email error message
function HelpMailError() {document.getElementById('emailaddress').style.borderColor="#FF0000";}
/////////// check help email
function HelpMailCheck(emailStr) {
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
var msg="This email address does not seem to be valid.";
if (matchArray==null) {alert(msg); HelpMailError(); return false;}
var user=matchArray[1];var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {alert(msg); HelpMailError(); return false;}}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {alert(msg); HelpMailError(); return false;}}
if (user.match(userPat)==null) {alert(msg); HelpMailError(); return false;}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {alert(msg); HelpMailError(); return false;}}
return true;}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {alert(msg); HelpMailError(); return false;}}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {alert(msg); HelpMailError(); return false;}
if (len<2) {alert(msg); HelpMailError(); return false;}
return true;}
/////////// check help email
//////////
function CheckHelpdesk() {var result = true; var msg=""; 
if (document.helpdesk.help_firstname.value=="") 
{msg+="Please enter your first name! \n"; document.getElementById('help_firstname').style.borderColor="#FF0000"; 
document.helpdesk.help_firstname.focus(); result = false;} 
if (document.helpdesk.help_firstname.value!=="") {document.getElementById('help_firstname').style.borderColor="#CCCCCC";}
//
if (document.helpdesk.help_lastname.value=="") 
{msg+="Please enter your last name! \n"; document.getElementById('help_lastname').style.borderColor="#FF0000"; 
document.helpdesk.help_lastname.focus(); result = false;} 
if (document.helpdesk.help_lastname.value!=="") {document.getElementById('help_lastname').style.borderColor="#CCCCCC";}
//
if (document.helpdesk.emailaddress.value=="") 
{msg+="Please enter your E Mail Address! \n"; document.getElementById('emailaddress').style.borderColor="#FF0000"; 
document.helpdesk.emailaddress.focus(); result = false;} 
if (document.helpdesk.emailaddress.value!=="") {document.getElementById('emailaddress').style.backgroundColor="#FFFFFF";}
//
//
if (document.helpdesk.help_question.options[0].selected) 
{msg+="Please select your Problems / Questions! \n"; document.helpdesk.help_question.focus(); result = false;} 
//
//
if (document.helpdesk.limitedtextarea.value=="") 
{msg+="Please enter a message! \n"; document.getElementById('limitedtextarea').style.borderColor="#FF0000"; 
document.helpdesk.limitedtextarea.focus(); result = false;} 
if (document.helpdesk.limitedtextarea.value!=="") {document.getElementById('limitedtextarea').style.backgroundColor="#FFFFFF";}
//
if(msg==""){ 
return result; 
}{ 
alert(msg) 
return result; 
}} 
/////////////

// helpdesk 

/////////////////////////////////
//alert////
/////////////////////////////////
var ns4=document.layers; var ie4=document.all; var ns6=document.getElementById&&!document.all; 
//drag drop function for NS 4////
/////////////////////////////////
var dragswitch=0; var nsx; ; var nsy; var nstemp
/////////
function drag_dropns(name){ if (!ns4) return temp=eval(name); temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP); temp.onmousedown=gons; temp.onmousemove=dragns; temp.onmouseup=stopns;}
/////////
function gons(e){temp.captureEvents(Event.MOUSEMOVE); nsx=e.x; nsy=e.y; }
function dragns(e){if (dragswitch==1){temp.moveBy(e.x-nsx,e.y-nsy); return false}}
/////////
function stopns(){temp.releaseEvents(Event.MOUSEMOVE);}
//drag drop function for ie4+ and NS6////
/////////////////////////////////
function drag_drop(e){if (ie4&&dragapproved){crossobj.style.left=tempx+event.clientX-offsetx; crossobj.style.top=tempy+event.clientY-offsety; return false} else if (ns6&&dragapproved){crossobj.style.left=tempx+e.clientX-offsetx+"px";crossobj.style.top=tempy+e.clientY-offsety+"px"; return false}}
///////
function initializedrag(e){crossobj=ns6? document.getElementById("showimage") : document.all.showimage; var firedobj=ns6? e.target : event.srcElement; var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"; while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){firedobj=ns6? firedobj.parentNode : firedobj.parentElement;}
///////
if (firedobj.id=="dragbar"){offsetx=ie4? event.clientX : e.clientX; offsety=ie4? event.clientY : e.clientY; tempx=parseInt(crossobj.style.left); tempy=parseInt(crossobj.style.top);dragapproved=true ;document.onmousemove=drag_drop ;}}
document.onmouseup=new Function("dragapproved=false")
////drag drop functions end here//////
function hidebox(){crossobj=ns6? document.getElementById("showimage") : document.all.showimage; 
if (ie4||ns6) crossobj.style.visibility="hidden"; else if (ns4) document.showimage.visibility="hide";}

/////////////////////////////////
//alert////
/////////////////////////////////

function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",800)
}
window.onload = startBlink;

/////////////////////////////////
// download link page
function downloadlink()
{document.getElementById('downloadlinkinfo').style.display="none";
document.getElementById('downloadlink').style.display="block";}
// download link page