function controlDivVisibility(fieldControl, fieldDiv)
{
  var varDiv = document.getElementById(fieldDiv);
  if (fieldControl.checked) 
  {
    varDiv.style.display='';
  }
  else
  {
    varDiv.style.display='none';
  }
  return true;
}
function CapsLockOn(e)
{
  
}
function SetDivAdvanceStatus()
{
  var varDiv = document.getElementById("divAdvanceSearch");
  if (varDiv == null)
  {
    if (confirm("You must go to VideoAdz home page to show advance search panel"))
    {
      window.location = "default.aspx";
    }
    else
    {
      return;
    }
  } 
  if (varDiv.style.display == 'none')
  {
    varDiv.style.display = '';
    document.aspnetForm.ctl00$MainContentPlaceHolder$Ctl_Search1$cbAdvanceSearch.checked = true;
  }
  else
  {
    varDiv.style.display = 'none';
    document.aspnetForm.ctl00$MainContentPlaceHolder$Ctl_Search1$cbAdvanceSearch.checked = false;
  }
}
function CekBusinessSearch(tbBusinessType)
{
  if (tbBusinessType.value == "")
  {
    lockScreen("Please input search condition in the textbox","");
    return false;
  }
  return true;
}
function CheckBusinessAddEdit(tbName,tbDescription)
{
  var strError = "";
  var bError = false;
  if (tbName.value == "")
  {
    strError = strError + "Please input Business Type name<br>";
    bError = true;
  }
  if (tbDescription.value == "")
  {
    strError = strError + "Please input Business Type description";
    bError = true;
  }
  if (bError)
  {
    lockScreen(strError,'');
    return false;
  }
  else
    return true;
}
function ChangeVideo(strCode)
{
//  var param = "GetVideo.aspx?file=";
//  if (strCode != null)
//    param = param + strCode;
//  else
//    param = "";
  var flashObjStr = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='370' height='238' id='player' align='middle'> " +
                      "<param name='allowScriptAccess' value='sameDomain' /> " +
                      "<param name='allowFullScreen' value='true' /> " + 
                      "<param name='movie' value='player.swf?video_id=Directories/videogallery/"+ strCode +".flv' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /> " +
                      "<embed src='player.swf?video_id="+ strCode +".flv' quality='high' bgcolor='#ffffff' width='370' height='238' name='player' align='middle' allowScriptAccess='sameDomain' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> " +
                     "</object>";
  document.getElementById('divVideo').innerHTML = flashObjStr;
}
var flashVideo = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='370' height='238' id='player' align='middle'> " + 
                 "<param name='allowScriptAccess' value='sameDomain' />" +
                 "<param name='allowFullScreen' value='true' />" +
                 "<param name='scale' value='noborder' /> " +
                 "<param name='salign' value='tl' /> " +                 
                 "<param name='movie' value='player.swf?video_id=###&auto_play=false&auto_play_delay=1&widescreen=true' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' />" +
                 "<embed src='player.swf?video_id=###&auto_play=false&auto_play_delay=1&widescreen=true' quality='high' bgcolor='#ffffff' width='370' height='238' name='player' align='middle' allowScriptAccess='sameDomain' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' scale='noborder' salign='tl'/>" + 
                 "</object>";
function ChangeVideoAdmin(ddPage)
{
  var divVideo = document.getElementById("VideoAdmin");
  if (ddPage.selectedIndex == 0)
  {
    divVideo.innerHTML = flashAdmin;
  }
  else
  {
    divVideo.innerHTML = flashAdvertiser;
  }
}
function setWebMethod(business)
{
  var autoComplete = $find("AutoCompleteEx");
  if(business == "type")
  autoComplete.set_serviceMethod("GetBusinessType");
  else
  autoComplete.set_serviceMethod("GetBusinessName");
  return true;
}
function setWebMethod2()
{
  var rbBusinessType = document.getElementById('ctl00_MainContentPlaceHolder_Ctl_Search1_rbBusinessType');
  var autoComplete = $find("AutoCompleteEx");
  isFocus = true;
  if (rbBusinessType.checked)
    autoComplete.set_serviceMethod("GetBusinessType");
  else
    autoComplete.set_serviceMethod("GetBusinessName");
}
function GetQuotes()
{
  var param = "0";
  if (document.aspnetForm.cbListings != null)
  {
    if (document.aspnetForm.cbListings.length == null)
      param = param + "," + document.aspnetForm.cbListings.value;
    else
    {
      for (i=0; i<document.aspnetForm.cbListings.length; i++)
      {
        if (document.aspnetForm.cbListings[i].checked==true)
          param = param + "," + document.aspnetForm.cbListings[i].value;
      }
    }
    if (param != "0")
      window.location="get_quote.aspx?code="+param;
    else
      lockScreen("<li>Please select at least one company from the search result</li>","default");
  }
  else
  {
    lockScreen("<li>There are no search result can be found for your request. Please do search until search result are not empty</li>","default");
  }
  return false;
}
function GetPrint()
{
  var param = "0";
  if (document.aspnetForm.cbListings != null)
  {
    if (document.aspnetForm.cbListings.length == null)
      param = param + "," + document.aspnetForm.cbListings.value;
    else
    {
      for (i=0; i<document.aspnetForm.cbListings.length; i++)
      {
        if (document.aspnetForm.cbListings[i].checked==true)
          param = param + "," + document.aspnetForm.cbListings[i].value;
      }
    }
    if (param != "0")
      window.open ('print_results.aspx?code='+param,"mywindow","menubar=1,location=1,status=1,scrollbars=1, width=800px,height=500px");
    else
      lockScreen("<li>Please select at least one company from the search result</li>","default");
  }
  else
  {
    lockScreen("<li>There are no search result can be found for your request. Please do search until search result are not empty</li>","default");
  }  
  return false;
}
function OpenWebLink(thisURL)
{
  if (thisURL.indexOf("http://") < 0 )
    thisURL = "http://" + thisURL;
  window.open (thisURL,"mywindow","resizable=1,menubar=1,location=1,status=1,scrollbars=1");
  return true;
}
function PopupPrint(thisURL)
{
  window.open (thisURL,"mywindow","menubar=1,location=1,status=1,scrollbars=1, width=800px,height=500px");
  return false;
}
function PopupShareVideo(thisURL)
{		  
  window.open (thisURL,"mywindow","menubar=0,location=0,status=0,scrollbars=0, width=400px,height=555px");
  return false;
}
function PopupReceipt(URL)
{
  window.showModalDialog(URL,"","dialogWidth:400px;dialogHeight:600px");
  return false;
}
function ValidateLogin()
{
 var userName = document.getElementById('ctl00_MainContentPlaceHolder_tbUserName').value;
 var password = document.getElementById('ctl00_MainContentPlaceHolder_tbPassword').value;
 if(RegularExpressionCheck(userName,'EM') && password != '')
  return true;
 else
 {
  var strError = '';
  if (!RegularExpressionCheck(userName,'EM'))
    strError = '<li>Please input the correct email address format </li>';
  if (password == '')
    strError = strError + '<li>Please input password</li>';      
  lockScreen(strError,"");
  return false;
 }
}
function ValidateEmail(email)
{  
  if(RegularExpressionCheck(email.value,'EM'))
    return true;
  else
  {
    lockScreen("<li>Please input the correct email format</li>","");
    return false;
  }
}
function ValidateEmail3(email)
{ 
  if (email.value != '')
  { 
    if(RegularExpressionCheck(email.value,'EM'))
      return true;
    else
    {
      lockScreen("Please input the correct email format","");
      return false;
    }
  }
  else 
    return true;
}
function ValidateEmail2(email,cb)
{  
  var val = email.value;
  if(RegularExpressionCheck(val,'EM'))
    return true;
  else
  {
    cb.checked = false;
    email.value = "";
    email.disabled = true;
    email.style.background= "#C0C0C0";
    lockScreen('<li>Please input email address with correct format</li>','');
    return false;
  }
}
function RegularExpressionCheck(theValue,theExpType) 
{
	var theExp;
	switch (theExpType)
	{
		case "EM": 
			theExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; // asareen@dvci.com
			break;
		case "ZIP": 
			theExp = /(^\d{5}$)|(^\d{5}-\d{4}$)/; // 99999 five digit or 9999-9999 five plus four
			break;
		case "AD": 
			theExp = /\d+/; // any number of digits
			break;
		case "AD3": 
			theExp = /\d{3}/; // 999
			break;
		case "AD4": 
			theExp = /\d{4}/; // 9999
			break;
		case "USP": 
			theExp = /^[2-9]\d{2}-\d{3}-\d{4}$/; //973-775-6456
			break;
		case "BAD": 
			theExp = /^([1-zA-Z0-1@.\s]{1,255})$/; //checks for existence of things like ‘,\,*,&,$,<,>
			break;
		default : 
			alert("None chosen");
	}
	var rx = new RegExp(theExp);
	if(theExp.test(theValue))
		return true;
	else
		return false;
}
function IsNumeric(objectID,strType,strMessage)
{
  if (objectID.value != '')
  {
    if(!isNaN(objectID.value))
      return true;
    else
    {
      objectID.value = objectID.value.substr(0,objectID.value.length - 1);
      if (strType == '')
        lockScreen('<li>Please input numeric value for '+ strMessage +'</li>','');
      if (strType == 'default')
        lockScreen('<li>Please input numeric value for '+ strMessage +'</li>','default');
      if (strType == 'registration')
        lockScreen('<li>Please input numeric value for '+ strMessage +'</li>','registration');
      if (strType == 'admin')
        lockScreen('*  Please input numeric value for '+ strMessage +'','admin');
      return false;
    }
  }
  else 
    return true;
}

function checkKiloPostcode(advance,kilo,postcode,showbusiness,tbPhoneNo,tbPhoneCode)
{
  if (advance.checked)
  {
    var strError = "";
    var bError = false;
    if ((kilo.value != "" && postcode.value == "") || (kilo.value == "" && postcode.value != ""))
    {
      strError = strError + "<li>Please input both of postcode and maximum kilometers when you want to search company who has distance not more than your postcode</li>";
      bError = true;
    }
    if (showbusiness.checked && postcode.value == "")
    {
      strError = strError + "<li>Please input postcode when you click show business who serviced my area but located outside</li>";
      bError = true;
    }
    if ((tbPhoneCode.value == "" && tbPhoneNo.value != "") || (tbPhoneCode.value != "" && tbPhoneNo.value ==""))
    {
      strError = strError + "<li>You must enter both STD code and phone number when you searching by phone number</li>";
      bError = true;
    }
    if (bError)
    {
      lockScreen(strError,'default');
      return false;
    }
    else
      return true;
  }
  else
    return true;
}
function EnabledDisabledWillOpen(cbWillOpen,ddDay,ddHour)
{
  if (cbWillOpen.checked)
  {
    ddDay.disabled = false;
    ddHour.disabled = false;
  }
  else
  {
    ddDay[0].selected = true;
    ddHour[0].selected = true;
    ddDay.disabled = true;
    ddHour.disabled = true;
  }
}
function EnabledDisabledTextBox(cbInputID,tbInputID,cbInputID2)
{
  if (cbInputID.checked)
  {
    tbInputID.disabled = false;
    tbInputID.style.background= "#FFFFFF";    
    cbInputID2.disabled = false;
  }
  else
  {
    tbInputID.value = "";
    tbInputID.disabled = true;
    tbInputID.style.background= "#C0C0C0";
    cbInputID2.checked = false;
    cbInputID2.disabled = true;
  }
}
function EnabledDisabledTextBox3(cbInputID,tbInputID)
{
  if (cbInputID.checked)
  {
    tbInputID.disabled = false;
    tbInputID.style.background= "#FFFFFF";  
  }
  else
  {
    tbInputID.value = "";
    tbInputID.style.background= "#C0C0C0";
    tbInputID.disabled = true;
  }
}

function EnabledDisabledTextbox4(rbBusinessName,rbPersonalRequest,tbFromName)
{
  if (rbBusinessName.checked)
  {
    tbFromName.disabled = false;
    tbFromName.style.background= "#FFFFFF";
  }
  else
  {
    tbFromName.disabled = true;
    tbFromName.value = "";
    tbFromName.style.background= "#C0C0C0";
  }
}

function CheckContactUsRequest(rbBusinessName,tbFromName,cbEmail,tbEmail,cbPhone,tbPhoneCode,tbPhoneNo,cbFax,tbFaxCode,tbFaxNo,cbMobile,tbMobileCode,tbMobileNo,tbMyName)
{
  var bError = false;
  var strError = "";
  var count = 0 ;
  if (tbMyName.value == "")
  {
    bError = true;
    strError = strError + "<li>Please input your name to cotact VideoAdz</li>";
    count++;
  }
  if (rbBusinessName.checked && tbFromName.value == "")
  {
    bError = true;
    strError = strError + "<li>Please input Business Name since you check the business name radio button</li>";
    count++;
  }
  if (cbEmail.checked && tbEmail.value == "")
  {
    bError = true;
    strError = strError + "<li>Please input Email Address since you check the email address checkbox</li>";
    count++;
  }  
  if (cbPhone.checked && (tbPhoneCode.value == "" || tbPhoneNo.value == ""))
  {
    bError = true;
    strError = strError + "<li>Please input complete Phone No since you check the phone number checkbox</li>";
    count++;
  }
  if (cbFax.checked && (tbFaxCode.value == "" || tbFaxNo.value == ""))
  {
    bError = true;
    strError = strError + "<li>Please input complete Fax No since you check the fax number checkbox</li>";
    count++;
  }
  if (cbMobile.checked && (tbMobileCode.value == "" || tbMobileNo.value == ""))
  {
    bError = true;
    strError = strError + "<li>Please input complete Mobile No since you check the mobile number checkbox</li>";
    count++;
  }
  if (bError)
  {
    lockScreen(strError,'');
    return false
  }
  else
    return true;
}
function EnabledDisabledTextBox5(cbInputID,tbInputID1,tbInputID2)
{
  if (cbInputID.checked)
  {
    tbInputID1.disabled = false;
    tbInputID2.disabled = false;
    tbInputID1.value = "08:00";
    tbInputID2.value = "17:00";
    tbInputID1.style.background= "#FFFFFF";
    tbInputID2.style.background= "#FFFFFF";
  }
  else
  {
    tbInputID1.value = "";
    tbInputID2.value = "";
    tbInputID1.style.background= "#C0C0C0";
    tbInputID2.style.background= "#C0C0C0";
    tbInputID1.disabled = true;
    tbInputID2.disabled = true;
  }
}
function EnabledDisabledTextBox2(cbInputID,tbInputID1,tbInputID2)
{
  if (cbInputID.checked)
  {
    tbInputID1.disabled = false;
    tbInputID2.disabled = false;
    tbInputID1.style.background= "#FFFFFF";
    tbInputID2.style.background= "#FFFFFF";
  }
  else
  {
    tbInputID1.value = "";
    tbInputID2.value = "";
    tbInputID1.style.background= "#C0C0C0";
    tbInputID2.style.background= "#C0C0C0";
    tbInputID1.disabled = true;
    tbInputID2.disabled = true;
  }
}

function CheckEmailCB(cbNotification,cbEmail)
{
  if (cbNotification.checked && !cbEmail.checked)
  {
    cbNotification.checked = false;
    lockScreen("<li>Please check the email address and fill it when you want a copy of email</li>",'');
  }
}

function CheckInappropriateRequest(rbBusinessName,tbFromName,cbEmail,tbEmail,cbFax,tbFaxCode,tbFaxNo,cbMobile,tbMobileCode,tbMobileNo,cbPhone,tbPhoneCode,tbPhoneNo,tbMyName,tbComment)
{
  var strError = "";
  var bError = false;
  var count = 0;
  if (tbComment.value == "")
  {
    strError = strError + "<li>Please input your comment </li>";
    bError = true;
    count++;
  }
  if (tbMyName.value == "")
  {
    strError = strError + "<li>Please input your name </li>";
    bError = true;
    count++;
  }
  if (rbBusinessName.checked && tbFromName.value == "")
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input business name since you check the business name radio button</li>";
  }
  if (cbEmail.checked && tbEmail.value == "")
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input email address since you check the email checkbox</li>";
  }  
  if (cbPhone.checked && (tbPhoneCode.value == "" || tbPhoneNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete phone code and phone number since you check the phone checkbox</li>";
  }
  if (cbFax.checked && (tbFaxCode.value == "" || tbFaxNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete fax code and fax no since you check the fax checkbox</li>";
  }
  if (cbMobile.checked && (tbMobileCode.value == "" || tbMobileNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete mobile no and mobile code since you check the mobile checkbox</li>";
  }
  if (bError)
  {
    lockScreen(strError,'');
    return false;
  }
  else
    return true;
}

function CheckQuoteRequest(tbMyRequest,tbMyName,tbResponseDate,rbBusinessName,tbFromName,cbEmail,tbEmail,cbFax,tbFaxCode,tbFaxNo,cbPhone,tbPhoneCode,tbPhoneNo,cbMobile,tbMobileCode,tbMobileNo,cbMail,tbMail)
{
  var strError = "";
  var bError = false;
  var count = 0;
  if (tbMyRequest.value == "")
  {
    strError = strError + "<li>Please input your request </li>";
    bError = true;
    count++;
  }
  if (tbMyName.value == "")
  {
    strError = strError + "<li>Please input your name </li>";
    bError = true;
    count++;
  }
//  if (tbResponseDate.value == "")
//  {
//    strError = strError + "<li>Please input your response time textbox </li>";
//    bError = true;
//    count++;
//  }
  if (rbBusinessName.checked && tbFromName.value == "")
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input business name since you check the business name radio button</li>";
  }
  if (cbEmail.checked && tbEmail.value == "")
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input email address since you check the email checkbox</li>";
  }  
  if (cbPhone.checked && (tbPhoneCode.value == "" || tbPhoneNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete phone code and phone number since you check the phone checkbox</li>";
  }
  if (cbFax.checked && (tbFaxCode.value == "" || tbFaxNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete fax code and fax no since you check the fax checkbox</li>";
  }
  if (cbMobile.checked && (tbMobileCode.value == "" || tbMobileNo.value == ""))
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input complete mobile no and mobile code since you check the mobile checkbox</li>";
  }
  if (cbMail.checked && tbMail.value == "")
  {
    bError = true;
    count++;
    strError = strError + "<li>Please input body mail since you check the mail checkbox</li>";
  }  
  if (bError)
  {
    lockScreen(strError,'');
    return false;
  }
  else
    return true;
}
function CheckChangePassword(tbPassword,tbRePassword)
{
  if (tbPassword.value.length <2)
  {
    lockScreen("<li>Password length must be more then two digits, please input the correct one</li>",'');
    return false;
  }
  if (tbPassword.value != tbRePassword.value)
  {
    lockScreen("<li>Please enter the same string in both of password and re-enter password</li>");
    return false;
  }
  return true;
}
function EnabledDisabledUpload2(fuVideo,rb43Ratio,rb169Ratio)
{
  var rbUploadOwn = document.getElementById('ctl00_MainContentPlaceHolder_rbUploadOwn');
  var rbLive = document.getElementById('ctl00_MainContentPlaceHolder_rbLive');
  if (rbUploadOwn.checked)
  {
    fuVideo.disabled = false;
    rbLive.disabled = false;
    rb43Ratio.disabled = false;
    rb169Ratio.disabled = false;
  }
}
function EnabledDisabledUpload(UploadVideo)
{
  
  var rbRequestVideoAdz = document.getElementById('ctl00_MainContentPlaceHolder_rbRequestVideoAdz');
  var rbUploadLater = document.getElementById('ctl00_MainContentPlaceHolder_rbUploadLater');
  var rbDraft = document.getElementById('ctl00_MainContentPlaceHolder_rbDraft');
  var rbLive = document.getElementById('ctl00_MainContentPlaceHolder_rbLive');
  var rb43Ratio = document.getElementById('ctl00_MainContentPlaceHolder_rb43Ratio');
  var rb169Ratio = document.getElementById('ctl00_MainContentPlaceHolder_rb169Ratio');
  
  if (rbRequestVideoAdz.checked)
  {
    UploadVideo.value = "";
    UploadVideo.disabled = true;
    rbLive.checked = false;
    rbDraft.checked = true;
    rbLive.disabled = true;
    rb43Ratio.disabled = true;
    rb169Ratio.disabled = true;
  }
  else if (rbUploadLater.checked)
  {
    UploadVideo.value = "";
    UploadVideo.disabled = true;
    rbLive.disabled = false;
    rbLive.checked = true;    
    rb43Ratio.disabled = true;
    rb169Ratio.disabled = true;
  }
}
function CheckPostcodesServiced(tbPostcodesServiced)
{
  var theExp = /^[0-9]{2,4}(((,|-)[0-9]{2,4})?)*$/;
  if(theExp.test(tbPostcodesServiced.value))
  {
    return true;
  }
  else
  {
    lockScreen("Please input Postcodes Serviced with correct format",'');
    tbPostcodesServiced.value = "";
    return false;
  }
}
function IsCardExpiry(tbCardExpiry)
{
  var theExp = /^([0][1-9]|[1][0-2])([0-9][0-9])$/;
  if(theExp.test(tbCardExpiry.value))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function CheckTimeTradingDay(tbInput)
{
  var theExp = /^([0-2][0-4]|[0-1][0-9])(:)[0-5][0-9]$/;
   if(theExp.test(tbInput.value))
   {
    return true;
   }
   else
   {
//    alert("Please input with correct format (HH:MM)");
//    tbInput.value = "";
    return false;
   }
}
function IsNotSupportedImageFile(strFile)
{
  var SupportedImageFile = new Array(4);
  SupportedImageFile[0]=".gif";
  SupportedImageFile[1]=".jpg";
  SupportedImageFile[2]=".png";
  SupportedImageFile[3]=".bmp"; 
  var bError = true;
  for (var i=0;i<4;i++)
  {
    if (strFile == SupportedImageFile[i])
      bError = false;
  }
  return bError;  
}
function IsNotSupportedVideoFile(strFile)
{
  var SupportedVideoFile = new Array(6);
  SupportedVideoFile[0]=".mov";
  SupportedVideoFile[1]=".3gp";
  SupportedVideoFile[2]=".mpg";
  SupportedVideoFile[3]=".flv"; 
  SupportedVideoFile[4]=".avi";
  SupportedVideoFile[5]=".mp4";
  var bError = true;
  for (var i=0;i<6;i++)
  {
    if (strFile == SupportedVideoFile[i])
      bError = false;
  }
  return bError;  
}
function CheckUploadVideo(fuVideo)
{
  if (fuVideo.value != "" && IsNotSupportedVideoFile(fuVideo.value.substr(fuVideo.value.length - 4,fuVideo.value.length - 1).toLowerCase()))
  {
    lockScreen("<li>Please input the correct format File for Video Preview (MOV,FLV,3GP,MPG,MP4,AVI)</li>","VideoRequest");
    return false;
  }
  else
    return true;
}
function CheckUploadVideo2(fuVideo)
{
  if (fuVideo.value != "" && IsNotSupportedVideoFile(fuVideo.value.substr(fuVideo.value.length - 4,fuVideo.value.length - 1).toLowerCase()))
  {
    lockScreen("Please input the correct format File for Video Preview (MOV,FLV,3GP,MPG,MP4,AVI)","VideoAdmin");
    return false;
  }
  else if(fuVideo.value == "")
  {
    lockScreen("Please input video","VideoAdmin");  
    return false;
  }
  else
    return true;
}
function ClearSaveListing(tbSiteAddress, tbBusinessName,tbTagline,tbDescription,tbProdukListing,tbAddress1,tbAddress2,tbSuburb,tbPostcode,tbPhoneCode,tbPhoneNoPre,tbPostCodeServiced,fuBusinessLogo,fuVideo,cbMonday,tbMondayFrom,tbMondayFinish,cbTuesday,tbTuesdayFrom,tbTuesdayFinish,cbWednesday,tbWednesdayFrom,tbWednesdayFinish,cbThrusday,tbThrusdayFrom,tbThrusdayFinish,cbFriday,tbFridayFrom,tbFridayFinish,cbSaturday,tbSaturdayFrom,tbSaturdayFinish,cbSunday,tbSundayFrom,tbSundayFinish,rbUploadOwn,fuVideoPreview)
{
  document.aspnetForm.reset();
//  tbBusinessName.value = "";
//  tbTagline.value = "";
//  tbDescription.value = "";
//  tbProdukListing.value = "";
//  tbAddress1.value = "";
//  tbAddress2.value = "";
//  tbSuburb.value = "";
//  tbSiteAddress.value = "";
//  tbPostcode.value = "";
//  tbPhoneCode.value = "";
//  tbPhoneNoPre.value = "";
//  tbPostCodeServiced.value = "";
//  fuBusinessLogo.value = "";
//  fuVideoPreview.value = "";
//  fuVideo.value = "";
  
  cbMonday.checked = false;
  tbMondayFrom.value = "";
  tbMondayFinish.value = "";
  tbMondayFrom.style.background= "#C0C0C0";
  tbMondayFinish.style.background= "#C0C0C0";
  tbMondayFrom.disabled = true;
  tbMondayFinish.disabled = true;
  
  cbTuesday.checked = false;
  tbTuesdayFrom.value = "";
  tbTuesdayFinish.value = "";
  tbTuesdayFrom.style.background= "#C0C0C0";
  tbTuesdayFinish.style.background= "#C0C0C0";
  tbTuesdayFrom.disabled = true;
  tbTuesdayFinish.disabled = true;
  
  cbWednesday.checked = false;
  tbWednesdayFrom.value = "";
  tbWednesdayFinish.value = "";
  tbWednesdayFrom.style.background= "#C0C0C0";
  tbWednesdayFinish.style.background= "#C0C0C0";
  tbWednesdayFrom.disabled = true;
  tbWednesdayFinish.disabled = true;
  
  cbThrusday.checked = false;
  tbThrusdayFrom.value = "";
  tbThrusdayFinish.value = "";
  tbThrusdayFrom.style.background= "#C0C0C0";
  tbThrusdayFinish.style.background= "#C0C0C0";
  tbThrusdayFrom.disabled = true;
  tbThrusdayFinish.disabled = true;
  
  cbFriday.checked = false;
  tbFridayFrom.value = "";
  tbFridayFinish.value = "";
  tbFridayFrom.style.background= "#C0C0C0";
  tbFridayFinish.style.background= "#C0C0C0";
  tbFridayFrom.disabled = true;
  tbFridayFinish.disabled = true;
  
  cbSaturday.checked = false;
  tbSaturdayFrom.value = "";
  tbSaturdayFinish.value = "";
  tbSaturdayFrom.style.background= "#C0C0C0";
  tbSaturdayFinish.style.background= "#C0C0C0";
  tbSaturdayFrom.disabled = true;
  tbSaturdayFinish.disabled = true;
  
  cbSunday.checked = false;
  tbSundayFrom.value = "";
  tbSundayFinish.value = "";
  tbSundayFrom.style.background= "#C0C0C0";
  tbSundayFinish.style.background= "#C0C0C0";
  tbSundayFrom.disabled = true;
  tbSundayFinish.disabled = true;
  
  return false;
}
function CheckSaveListing(tbBusinessName,tbTagline,tbDescription,tbProdukListing,tbAddress1,tbSuburb,tbPostcode,tbPhoneCode,tbPhoneNoPre,tbPostCodeServiced,fuBusinessLogo,fuVideo,cbMonday,tbMondayFrom,tbMondayFinish,cbTuesday,tbTuesdayFrom,tbTuesdayFinish,cbWednesday,tbWednesdayFrom,tbWednesdayFinish,cbThrusday,tbThrusdayFrom,tbThrusdayFinish,cbFriday,tbFridayFrom,tbFridayFinish,cbSaturday,tbSaturdayFrom,tbSaturdayFinish,cbSunday,tbSundayFrom,tbSundayFinish,rbUploadOwn,fuVideoPreview)
{
  
  var bError = false;
  var strMessagge = "";
  var count = 0;
  if (tbBusinessName.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Business Name</li>";
  }
  if (tbTagline.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Tagline</li>";
  }
  if (tbDescription.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Description</li>";
  }
  if (tbProdukListing.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Product Listing</li>";
  }
  if (tbAddress1.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Address1</li>";
  }
  if (tbSuburb.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Suburb</li>";
  }
  if (tbPostcode.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Postcode</li>";
  }
  if (tbPhoneCode.value == "" || tbPhoneNoPre.value == "" )
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Phone</li>";
  }
  if (tbPostCodeServiced.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input PostCode Serviced</li>";
  }
  if (fuBusinessLogo.value != "" && IsNotSupportedImageFile(fuBusinessLogo.value.substr(fuBusinessLogo.value.length - 4,fuBusinessLogo.value.length - 1).toLowerCase()))
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input the correct format File for Business Logo (GIF,JPG,PNG,BMP)</li>";
  }
  if (fuVideo.value != "" && IsNotSupportedVideoFile(fuVideo.value.substr(fuVideo.value.length - 4,fuVideo.value.length - 1).toLowerCase()))
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input the correct format File for Video Preview (MOV,FLV,3GP,MPG,MP4,AVI)</li>";
  }
  if (fuVideoPreview.value != "" && IsNotSupportedImageFile(fuVideoPreview.value.substr(fuVideoPreview.value.length - 4,fuVideoPreview.value.length - 1).toLowerCase()))
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input the correct format File for Video Preview (GIF,JPG,PNG,BMP)</li>";
  }
  if (fuVideo.value == "" && rbUploadOwn.checked)
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input File for Video since you want to upload by your self</li>";
  }  
  if (cbMonday.checked)
  {
    if (!CheckTimeTradingDay(tbMondayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Monday From</li>";
    }
    if (!CheckTimeTradingDay(tbMondayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Monday Finish</li>";
    }
  }
  if (cbTuesday.checked)
  {
    if (!CheckTimeTradingDay(tbTuesdayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Tuesday From</li>";
    }
    if (!CheckTimeTradingDay(tbTuesdayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Tuesday Finish</li>";
    }
  }
  if (cbWednesday.checked)
  {
    if (!CheckTimeTradingDay(tbWednesdayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Wednesday From</li>";
    }
    if (!CheckTimeTradingDay(tbWednesdayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Wednesday Finish</li>";
    }
  }
  if (cbThrusday.checked)
  {
    if (!CheckTimeTradingDay(tbThrusdayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Thrusday From</li>";
    }
    if (!CheckTimeTradingDay(tbThrusdayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Thrusday Finish</li>";
    }
  }
  if (cbFriday.checked)
  {
    if (!CheckTimeTradingDay(tbFridayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Friday From</li>";
    }
    if (!CheckTimeTradingDay(tbFridayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Friday Finish</li>";
    }
  }
  if (cbSaturday.checked)
  {
    if (!CheckTimeTradingDay(tbSaturdayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Saturday From</li>";
    }
    if (!CheckTimeTradingDay(tbSaturdayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Saturday Finish</li>";
    }
  }
  if (cbSunday.checked)
  {
    if (!CheckTimeTradingDay(tbSundayFrom))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Sunday From</li>";
    }
    if (!CheckTimeTradingDay(tbSundayFinish))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input with correct format (HH:MM) on Sunday Finish</li>";
    }
  }
  if (bError)
  {
    lockScreen(strMessagge,'');
    return false;
  }
  else
    return true;
}

function CheckUpdateDetail(tbBusinessName,tbContactName,tbContactPhoneCode,tbContactPhoneNo,tbEmailAddr,tbAddress1,tbSuburb,tbPostcode,tbPhoneCode,tbPhoneNoPre,tbPassword,tbPasswordConfirm,cbNewPassword)
{
  var bError = false;
  var strMessagge = "";
  var count = 0;
  if (tbBusinessName.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Business Name</li>";
  }
  if (tbContactName.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Contact Name</li>";
  }
  if (tbContactPhoneNo.value == "" || tbContactPhoneCode.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input both of Contact Phone number</li>";
  }
  if (tbEmailAddr.value == "")
  {    
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Email Address</li>";
  }
  else
  {
    if(!RegularExpressionCheck(tbEmailAddr.value,'EM'))
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input Email Address with correct format</li>";
    }
  }
  if (tbAddress1.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Address Line 1</li>";
  }
  if (tbSuburb.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Suburb</li>";
  }
  if (tbPostcode.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Postcode</li>";
  }
  if (tbPhoneCode.value == "" || tbPhoneNoPre.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input both of Phone Number</li>";
  }
  if (cbNewPassword.checked)
  {
    if (tbPassword.value == "" || tbPasswordConfirm.value == "")
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input not empty both of password between New Password and Confirm Password</li>";
    }
    else if (tbPassword.value != tbPasswordConfirm.value)
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Please input the same words of password between New Password and Confirm Password</li>";
    }
    else if (tbPassword.value.length < 2)
    {
      count++;
      bError = true;
      strMessagge = strMessagge + "<li>Password minimum is two digits, please input the correct one</li>";
    }
  }
  if (bError)
  {
    lockScreen(strMessagge,'');
    return false;
  }
  else
    return true;
}
function CheckLookupReceipt(tbReceiptID)
{
  if (tbReceiptID.value == "")
  {
    lockScreen("Please input receipt ID");
    return false;
  }
  else
    return true;
}
function CheckMakePayment(tbCCNo,tbNameOnCard,tbExpDate)
{
  var bError = false;
  var strMessagge = "";
  
  if (tbCCNo.value == "")
  {
    bError = true;
    strMessagge = strMessagge + "<li>Please input Credit Card no</li>";
  }
  if (tbNameOnCard.value == "")
  {
    bError = true;
    strMessagge = strMessagge + "<li>Please input Name on card</li>";
  }
  if (IsCardExpiry(tbExpDate))
  {
  }
  else
  {
    bError = true;
    strMessagge = strMessagge + "<li>Please input ExpDate (MMYY)</li>";
  }
  if (bError)
  {
    lockScreen(strMessagge,'');
    return false;
  }
  else
    return true;
}
function lockScreen(strError,strType) 
{ 
 var divErrorOverlay = document.getElementById('errorOverlay');
 var divErrorMessage = document.getElementById('errorMessage'); 
 
 divErrorOverlay.style.left = Math.floor((document.documentElement.clientWidth - divErrorOverlay.offsetWidth)/2) + 'px';
 divErrorOverlay.style.top = Math.floor((document.documentElement.clientHeight - divErrorOverlay.offsetHeight)/2) + 'px';
 
 divErrorOverlay.disabled = false;
 divErrorMessage.disabled = false;
 
 divErrorOverlay.style.visibility = 'visible';
 divErrorMessage.innerHTML = strError;
 window.location = "#";
 
 var divErrorOverlayLeftBanner = document.getElementById('errorOverlayLeftBanner');
 var nMaxLeftOverlay = 86 + parseInt(divErrorOverlay.clientHeight) - 110 ;
 divErrorOverlayLeftBanner.style.height = nMaxLeftOverlay + "px";
 
 if (strType == 'default')
 {
  var divVideo = document.getElementById('divVideo');
  divVideo.style.visibility = 'hidden';
  var divContent = document.getElementById('content');
  divContent.disabled = true;
 }
 else if (strType == 'VideoAdmin')
 {
  var divVideo = document.getElementById('VideoAdmin');
  divVideo.style.visibility = 'hidden';
  var divContent = document.getElementById('content');
  divContent.disabled = true;
 }
 else if (strType == 'registration')
 {
  var divContent = document.getElementById('content');
  divContent.disabled = true;
 }
 else if (strType == 'VideoRequest')
 {
  var divContent = document.getElementById('content4');
  divContent.disabled = true;
 }
 else
 {
  var divContent = document.getElementById('content');
  divContent.disabled = true;
 }
}
function releaseScreen(strType)
{
  var divErrorOverlay = document.getElementById('errorOverlay');
  divErrorOverlay.style.visibility = 'hidden';
 if (strType == 'default')
 {
  var divVideo = document.getElementById('divVideo');
  divVideo.style.visibility = 'visible';
  var divContent = document.getElementById('content');  
  divContent.disabled = false;
 }
 if (strType == 'VideoAdmin')
 {
  var divVideo = document.getElementById('VideoAdmin');
  divVideo.style.visibility = 'visible';
  var divContent = document.getElementById('content');  
  divContent.disabled = false;
 }
 else if (strType == 'registration')
 {
  var divContent = document.getElementById('content');  
  divContent.disabled = false;
 }
 else if (strType == 'VideoRequest')
 {
  var divContent = document.getElementById('content4');  
  divContent.disabled = false;
 }
 else
 {
  var divContent = document.getElementById('content');  
  divContent.disabled = false;
 }
}
function CheckRegistration(tbBusinessName,tbAddress1,tbSuburb,tbPostcode,tbPhoneCode,tbPhoneNoPre,tbContactName,tbContactPhoneCode,tbContactPhoneNo,tbEmailAddr,tbPassword,tbPasswordConfirm)
{
  var bError = false;
  var strMessagge = "";
  var count = 0;
  if (tbBusinessName.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Business Name</li>";
  }
  if (tbAddress1.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Addredd line 1</li>";
  }
  if (tbSuburb.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Suburb</li>";
  }
  if (tbPostcode.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Postcode</li>";
  }
  if (tbPhoneCode.value == "" || tbPhoneNoPre.value == "" )
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please complete Phone Number</li>";
  }
  if (tbContactName.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Contact Name</li>";
  }
  if (tbContactPhoneCode.value == "" || tbContactPhoneNo.value == "" )
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input complete Contact Phone Number</li>";
  }
  if (tbEmailAddr.value == "" )
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Email Address</li>";
  }
  else if(!RegularExpressionCheck(tbEmailAddr.value,'EM'))
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input Email Address with correct format</li>";
  }
    
  if (tbPassword.value == "" || tbPasswordConfirm.value == "")
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input not empty both of password between New Password and Confirm Password</li>";
  }
  else if (tbPassword.value != tbPasswordConfirm.value)
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Please input the same words of password between New Password and Confirm Password</li>";
  }
  else if (tbPassword.value.length < 2)
  {
    count++;
    bError = true;
    strMessagge = strMessagge + "<li>Password minimum is two digits, please input the correct one</li>";
  }
  if (bError)
  {
    lockScreen(strMessagge,'registration');
    return false;
  }
  else
    return true; 
  
}

//////////////
    var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
    var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
    var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
    
    var requiredMajorVersion = 8;
    var requiredMinorVersion = 0;
    var requiredRevision = 0;
    
    function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
    {
      versionStr = GetSwfVer();
      if (versionStr == -1 ) {
        return false;
      } else if (versionStr != 0) {
        if(isIE && isWin && !isOpera) {
          tempArray         = versionStr.split(" "); 	
          tempString        = tempArray[1];			
          versionArray      = tempString.split(",");	
        } else {
          versionArray      = versionStr.split(".");
        }
        var versionMajor      = versionArray[0];
        var versionMinor      = versionArray[1];
        var versionRevision   = versionArray[2];
              	      
        if (versionMajor > parseFloat(reqMajorVer)) {
          return true;
        } else if (versionMajor == parseFloat(reqMajorVer)) {
          if (versionMinor > parseFloat(reqMinorVer))
	          return true;
          else if (versionMinor == parseFloat(reqMinorVer)) {
	          if (versionRevision >= parseFloat(reqRevision))
		          return true;
          }
        }
        return false;
      }
    }
    
    function ControlVersion()
    {
      var version;
      var axo;
      var e;
      try {
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        version = axo.GetVariable("$version");
      } catch (e) {
      }

      if (!version)
      {
        try {
	        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
	        version = "WIN 6,0,21,0";
	        axo.AllowScriptAccess = "always";
	        version = axo.GetVariable("$version");
        } catch (e) {
        }
      }

      if (!version)
      {
        try {
	        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
	        version = axo.GetVariable("$version");
        } catch (e) {
        }
      }

      if (!version)
      {
        try {
	        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
	        version = "WIN 3,0,18,0";
        } catch (e) {
        }
      }

      if (!version)
      {
        try {
	        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
	        version = "WIN 2,0,0,11";
        } catch (e) {
	        version = -1;
        }
      }    	
      return version;
    }

    function GetSwfVer(){
      var flashVer = -1;    	
      if (navigator.plugins != null && navigator.plugins.length > 0) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
	        var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
	        var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
	        var descArray = flashDescription.split(" ");
	        var tempArrayMajor = descArray[2].split(".");			
	        var versionMajor = tempArrayMajor[0];
	        var versionMinor = tempArrayMajor[1];
	        var versionRevision = descArray[3];
	        if (versionRevision == "") {
		        versionRevision = descArray[4];
	        }
	        if (versionRevision[0] == "d") {
		        versionRevision = versionRevision.substring(1);
	        } else if (versionRevision[0] == "r") {
		        versionRevision = versionRevision.substring(1);
		        if (versionRevision.indexOf("d") > 0) {
			        versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
		        }
	        }
	        var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
    //			    alert("flashVer="+flashVer);
        }
      }
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
      else if ( isIE && isWin && !isOpera ) {
        flashVer = ControlVersion();
      }	
      return flashVer;
    }
    