﻿function check()
{
var x=confirm("Are you sure you want to Delete?")
if (x)
	return true;
else
    return false;	
}
function AggignForntplus()
{
var temp =document.getElementById('ctl00_hydForFont').value*1+1; 
document.getElementById('ctl00_hydForFont').value=temp+'';
if(temp>4)
{
document.getElementById('ctl00_hydForFont').value='4';
alert('You are at the highest possible font size.');
return false;
}
dynamicLayout(temp);
MainTableWidthPlus();
}


function AggignForntMinus()
{
var temp =document.getElementById('ctl00_hydForFont').value*1-1; 
document.getElementById('ctl00_hydForFont').value=temp+'';
if(temp<1)
{
document.getElementById('ctl00_hydForFont').value='1';
alert('You are at the lowest possible font size.');
return false;
}
dynamicLayout(temp);
MainTableWidthMinus();
}


function dynamicLayout(fontId)
{
if(fontId == '1') 
{
document.getElementById('ctl00_cssFile').href = 'style.css'; 
}
else if(fontId == '2') 
{
document.getElementById('ctl00_cssFile').href = 'style2.css'; 

}
else if(fontId == '3') 
{
document.getElementById('ctl00_cssFile').href = 'style3.css'; 
}
else if(fontId == '4') 
{
document.getElementById('ctl00_cssFile').href = 'style4.css'; 
}
else
{
document.getElementById('ctl00_cssFile').href = 'style.css'; 
}

}

function MainTableWidthPlus()
{
var divObj = document.getElementById("menubar");

// detect chrome
var is_chrome = /chrome/.test( navigator.userAgent.toLowerCase() );
if(!is_chrome)
{
    divObj.style.marginLeft="2px";
}

var width = screen.availWidth;
var temp =document.getElementById('ctl00_hydForFont').value*1+1;

if(temp == 2)
{
    tblMainTable.width = width - 22;
}
if(temp == 3)
{
    if(width == 800)
    {
        tblMainTable.width = width + 400;
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 200;
        window.scrollBy(110,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 100;
        window.scrollBy(60,0);
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 50;
        window.scrollBy(30,0);
    }
    else
    {
        tblMainTable.width = width;
    }

}
if(temp == 4)
{
    if(width == 800)
    {
        tblMainTable.width = width + 500;
        window.scrollBy(50,0);
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 300;
        window.scrollBy(50,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 200;
        window.scrollBy(50,0);
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 100;
        window.scrollBy(30,0);
    }
    else
    {
        tblMainTable.width = width;
        window.scrollBy(50,0);
    }
}
if(temp == 5)
{
    if(width == 800)
    {
        tblMainTable.width = width + 650;
        window.scrollBy(50,0);
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 400;
        window.scrollBy(50,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 300;
        window.scrollBy(50,0);
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 150;
        window.scrollBy(30,0);
    }
    else
    {
        tblMainTable.width = width;
    }
}
//document.getElementById('ctl00_hydForFont').value=temp+'';

}

function MainTableWidthMinus()
{
var divObj = document.getElementById("menubar");

// detect chrome
var is_chrome = /chrome/.test( navigator.userAgent.toLowerCase() );
if(!is_chrome)
{
    divObj.style.marginLeft="2px";
}

var width = screen.availWidth;
var temp = document.getElementById('ctl00_hydForFont').value*1-1;

if(temp == 0)
{
    tblMainTable.width = width - 22;
}
if(temp == 1)
{
    if(width == 800)
    {
        tblMainTable.width = width + 400;
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 200;
        window.scrollBy(-50,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 100;
        window.scrollBy(-50,0);
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 50;
        window.scrollBy(-20,0);
    }
    else
    {
        tblMainTable.width = width;
    }

}
if(temp == 2)
{
    if(width == 800)
    {
        tblMainTable.width = width + 500;
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 300;
        window.scrollBy(-50,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 200;
        window.scrollBy(-50,0);
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 100;
        window.scrollBy(-30,0);
    }
    else
    {
        tblMainTable.width = width;
    }
}
if(temp == 3)
{
    if(width == 800)
    {
        tblMainTable.width = width + 650;
    }
    else if(width == 1024)
    {
        tblMainTable.width = width + 400;
        window.scrollBy(-50,0);
    }
    else if(width == 1280)
    {
        tblMainTable.width = width + 300;
    }
    else if(width == 1440)
    {
        tblMainTable.width = width + 150;
        window.scrollBy(30,0);
    }
    else
    {
        tblMainTable.width = width;
    }
}
//document.getElementById('ctl00_hydForFont').value=temp+'';

}

function checkFeaturClient()
{

if(document.getElementById("ctl00_ContentPlaceHolder1_ddlClient").options[0].selected)
    {
        alert('Please select client.');
        document.getElementById("ctl00_ContentPlaceHolder1_ddlClient").focus();    
        return false;    
    }
//    if(document.getElementById("ctl00_ContentPlaceHolder1_txtStartDate").value=="")
//    {
//        alert('Please enter start date.');
//        document.getElementById("ctl00_ContentPlaceHolder1_txtStartDate").focus();    
//        return false;    
//    }
//    
//    if(document.getElementById("ctl00_ContentPlaceHolder1_txtEndDate").value=="")
//    {
//        alert('Please enter end date.');
//        document.getElementById("ctl00_ContentPlaceHolder1_txtEndDate").focus();    
//        return false;    
//    }
}
function checkVoucher()
{
 if(document.getElementById("ctl00_ContentPlaceHolder1_txtheading").value=="")
    {
        alert('Please enter heading.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtheading").focus();    
        return false;    
    }    
    
}
function checkCategory()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtSubcategory").value=="")
    {
        alert('Please enter subcategory.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtSubcategory").focus();    
        return false;    
    }
}

function checkPricePackage()
{
  
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtPackageName").value=="")
    {
        alert('Please enter package name.');
        document.getElementById("ctl00_ContentPlaceHolder1_txtPackageName").focus();    
        return false;    
    }
}

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);

	if (matchArray==null) 
	{
	alert("Your email address is incorrect. Please provide a valid email.");
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) 
	{
	if (user.charCodeAt(i)>127) 
	{
	alert("Ths username contains invalid characters.");
	return false;
	}
	}
	for (i=0; i<domain.length; i++) 
	{
	if (domain.charCodeAt(i)>127) 
	{
	alert("Ths domain name contains invalid characters.");
	return false;
	}
	}

	if (user.match(userPat)==null) 
	{
	alert("The username doesn't seem to be valid.");
	return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) 
	{
	for (var i=1;i<=4;i++) 
	{
	if (IPArray[i]>255) 
	{
		alert("Destination IP address is invalid!");
		return false;
	}
	}
	}
	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("The domain name does not seem to be valid.");
	return false;
	}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
	{
	alert("The address must end in a well-known domain or two letter " + "country.");
	return false;
	}
	if (len<2)
	{
	alert("This address is missing a hostname!");
	return false;
	}
	return true;
	}


function validateClient()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessName").value=="")
	{
		alert("Business name should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessName").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtContactname1").value=="")
	{
		alert("Contact name 1 should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtContactname1").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessphone").value=="")
	{
		alert("Business phone number should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessphone").focus();
		return false;
	}
	 if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value=="")
	{
		alert("Email should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
		return false;
	}
	
	 if(!emailCheck(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value))
	{		
		document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
		return false;
	}	
	
	
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtAddress").value=="")
	{
		alert("Address should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtAddress").focus();
		return false;
	}
	
	if(document.getElementById("ctl00_ContentPlaceHolder1_ddlAddressSuburb").options[0].selected)
	{
		alert("Please select address suburb.");
		document.getElementById("ctl00_ContentPlaceHolder1_ddlAddressSuburb").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtAbn").value=="")
	{
		alert("ABN should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtAbn").focus();
		return false;
	}
	
	if(document.getElementById("ctl00_ContentPlaceHolder1_chkterm").checked==false)
	{
		alert("Please tick and accept the terms and conditions to register.")
		document.getElementById("ctl00_ContentPlaceHolder1_chkterm").focus();
		return false;
	}
	
	
}

function validateClientReg()
{
if(document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessName").value=="")
	{
		alert("Business name should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessName").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtContactname1").value=="")
	{
		alert("Contact name 1 should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtContactname1").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessphone").value=="")
	{
		alert("Business phone number should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtBusinessphone").focus();
		return false;
	}
	 if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value=="")
	{
		alert("Email should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
		return false;
	}
	
	 if(!emailCheck(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value))
	{		
		document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").focus();
		return false;
	}	
	
	
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtAddress").value=="")
	{
		alert("Address should not be left blank.");
		document.getElementById("ctl00_ContentPlaceHolder1_txtAddress").focus();
		return false;
	}
	
	if(document.getElementById("ctl00_ContentPlaceHolder1_ddlAddressSuburb").options[0].selected)
	{
		alert("Please select address suburb.");
		document.getElementById("ctl00_ContentPlaceHolder1_ddlAddressSuburb").focus();
		return false;
	}
	if(document.getElementById("ctl00_ContentPlaceHolder1_txtAbn").value=="")
	{
		alert("ABN should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtAbn").focus();
		return false;
	}

	if(document.getElementById("ctl00_ContentPlaceHolder1_chkterm").checked==false)
	{
		alert("Please tick and accept our Pre-Registration Information and Membership Selection Criteria to register.")
		document.getElementById("ctl00_ContentPlaceHolder1_chkterm").focus();
		return false;
	}
    
	
	
	
	
	
	
}
function checklogin()
{
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value=="")
	{
		alert("User name should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").focus();
		return false;
	}
	
	 if(document.getElementById("ctl00_ContentPlaceHolder1_txtPassword").value=="")
	{
		alert("Password should not be left blank.")
		document.getElementById("ctl00_ContentPlaceHolder1_txtPassword").focus();
		return false;
	}

    

}
<!--
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_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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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_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];}
}
//-->

 function doitGoogle(htmfile) {
	popUpWin = window.open(htmfile,'smallWin','height=600,width=800,toolbar=0,location=0, directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes')
	if (navigator.appName == 'Netscape')
	 {
		popUpWin.focus()
	  }
 }
 function doitGoogle1(htmfile) {
	popUpWin = window.open(htmfile,'smallWin','height=450,width=550,toolbar=0,location=0, directories=0,status=0,menubar=0,scrollbars=yes,resizable=no')
	if (navigator.appName == 'Netscape')
	 {
		popUpWin.focus()
	  }
 }

 function checkOnHold(which)
 {
    if(which == "True")
    {
        alert("Please Un-Hold the client first");
        return false;
    }
 }


