﻿// JScript File

var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

// ===================================================================
// ========= Function for Form Input Effect ==================
/*function fncChkExtn(x)
{ 
	var id_value = x.value;
	if(id_value != '')
	{ 
		var valid_extensions = /(.doc|.docx|.txt)$/i;   
		if(!valid_extensions.test(id_value))
		{ 
			alert('Please upload MSWord or Text Format Files!')
		}
	} 
}*/
// ===================================================================


// ===================================================================
// ========= Function for Form Input Effect ==================

function fncChangeClassName(x)
{
	x.className="clsFrmTextBoxOnFocus";
}

function fncResetClassName(x,clsName)
{
	x.className=clsName;
}

function fncFormTextBoxOnFocus(x)
{
	x.className="clsFrmTextBoxOnFocus";
}

function fncFormTextBoxOnBlur(x,strClassName)
{
	x.className=strClassName;
}

// ===================================================================

// ===================================================================
// ========= Function for popup Window ===============================
function OpenWindow(url)
{
    window.open(url,"","width=500, height=500, status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=yes, scrollbars=yes");
	return false;
}
// ===================================================================

// ===================================================================
// ========= Function for Trim String  ===============================
function trim(inputString) 
{
	if (typeof inputString != "string")
	{
		return inputString; 
	}
	
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ")
	{ 
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") 
	{ 
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	
	while (retValue.indexOf("  ") != -1) 
	{ 
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
	}
	return retValue; 
}
// ===================================================================


// ===================================================================
// ========= Function for Email Validation ===========================
function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
// ===================================================================


// ===================================================================
// ========= Function for Number Validation ==========================
function isNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
// ===================================================================

// ===================================================================
// ========= Function for Phone Number Validation ====================
function isPhone(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
// ===================================================================


// ===================================================================
// ========= Function for image rollover =============================
function roll(img_name, img_src)
{
    document[img_name].src = img_src;
}
// ===================================================================

// ===================================================================
// ========= Function for image rollover border ======================
function rollborder(img_name)
{
    document[img_name].border = '2px';
}
// ===================================================================


// ===================================================================
// Management Team page Accordian Functions ==========================

function fncPlusAC()
{
    document.getElementById("divPlusAC").style.display="none";
    document.getElementById("divMinusAC").style.display="block";
    document.getElementById("divAC").style.display="block";
}
function fncMinusAC()
{
    document.getElementById("divPlusAC").style.display="block";
    document.getElementById("divMinusAC").style.display="none";
    document.getElementById("divAC").style.display="none";
}

function fncPlusAD()
{
    document.getElementById("divPlusAD").style.display="none";
    document.getElementById("divMinusAD").style.display="block";
    document.getElementById("divAD").style.display="block";
}
function fncMinusAD()
{
    document.getElementById("divPlusAD").style.display="block";
    document.getElementById("divMinusAD").style.display="none";
    document.getElementById("divAD").style.display="none";
}

function fncPlusSB()
{
    document.getElementById("divPlusSB").style.display="none";
    document.getElementById("divMinusSB").style.display="block";
    document.getElementById("divSB").style.display="block";
}
function fncMinusSB()
{
    document.getElementById("divPlusSB").style.display="block";
    document.getElementById("divMinusSB").style.display="none";
    document.getElementById("divSB").style.display="none";
}

function fncPlusSG()
{
    document.getElementById("divPlusSG").style.display="none";
    document.getElementById("divMinusSG").style.display="block";
    document.getElementById("divSG").style.display="block";
}
function fncMinusSG()
{
    document.getElementById("divPlusSG").style.display="block";
    document.getElementById("divMinusSG").style.display="none";
    document.getElementById("divSG").style.display="none";
}

function fncPlusZP()
{
    document.getElementById("divPlusZP").style.display="none";
    document.getElementById("divMinusZP").style.display="block";
    document.getElementById("divZP").style.display="block";
}
function fncMinusZP()
{
    document.getElementById("divPlusZP").style.display="block";
    document.getElementById("divMinusZP").style.display="none";
    document.getElementById("divZP").style.display="none";
}

function fncPlusVM()
{
    document.getElementById("divPlusVM").style.display="none";
    document.getElementById("divMinusVM").style.display="block";
    document.getElementById("divVM").style.display="block";
}
function fncMinusVM()
{
    document.getElementById("divPlusVM").style.display="block";
    document.getElementById("divMinusVM").style.display="none";
    document.getElementById("divVM").style.display="none";
}

function fncPlusVRO()
{
    document.getElementById("divPlusVRO").style.display="none";
    document.getElementById("divMinusVRO").style.display="block";
    document.getElementById("divVRO").style.display="block";
}
function fncMinusVRO()
{
    document.getElementById("divPlusVRO").style.display="block";
    document.getElementById("divMinusVRO").style.display="none";
    document.getElementById("divVRO").style.display="none";
}

function fncPlusMap()
{
    document.getElementById("divPlusMap").style.display="none";
    document.getElementById("divMinusMap").style.display="block";
    document.getElementById("divMap").style.display="block";
}
function fncMinusMap()
{
    document.getElementById("divPlusMap").style.display="block";
    document.getElementById("divMinusMap").style.display="none";
    document.getElementById("divMap").style.display="none";
}

function fncMTPlus(strDivPlus, strDivMinus, strDivContent)
{
	eval("document.getElementById('"+strDivPlus+"').style.display='none'");
    eval("document.getElementById('"+strDivMinus+"').style.display='block'");
    eval("document.getElementById('"+strDivContent+"').style.display='block'");
}

function fncMTMinus(strDivPlus, strDivMinus, strDivContent)
{
	eval("document.getElementById('"+strDivPlus+"').style.display='block'");
    eval("document.getElementById('"+strDivMinus+"').style.display='none'");
    eval("document.getElementById('"+strDivContent+"').style.display='none'");
}


function fncPlus(strPlusID,strMinusID,strDivSumID,strDivMainID)
{
	eval("document.getElementById('"+strPlusID+"').style.display='none'");
	eval("document.getElementById('"+strMinusID+"').style.display='block'");
	eval("document.getElementById('"+strDivSumID+"').style.display='none'");
	eval("document.getElementById('"+strDivMainID+"').style.display='block'");
}

function fncMinus(strPlusID,strMinusID,strDivSumID,strDivMainID)
{
	eval("document.getElementById('"+strPlusID+"').style.display='block'");
	eval("document.getElementById('"+strMinusID+"').style.display='none'");
	eval("document.getElementById('"+strDivSumID+"').style.display='block'");
	eval("document.getElementById('"+strDivMainID+"').style.display='none'");
}

function fncPlus_PR(strPlusID,strMinusID,strDivContentID)
{
	eval("document.getElementById('"+strPlusID+"').style.display='none'");
	eval("document.getElementById('"+strMinusID+"').style.display='block'");
	eval("document.getElementById('"+strDivContentID+"').style.display='block'");
}

function fncMinus_PR(strPlusID,strMinusID,strDivContentID)
{
	eval("document.getElementById('"+strPlusID+"').style.display='block'");
	eval("document.getElementById('"+strMinusID+"').style.display='none'");
	eval("document.getElementById('"+strDivContentID+"').style.display='none'");
}

// ===================================================================

// ==================================================================
// Home Page TextBox Text Show/Remove Functions =====================
function fncClickText(x)
{
    if (x.value=="search here")
    {
    x.value=""; 
    }
    
}
function fncClickOut(x)
{
    if(x.value=="")
    {
        x.value="search here";
    }
}

function fncClickText2(x)
{
    if (x.value=="Please type your ref no here")
    {
    x.value=""; 
    }
    
}
function fncClickOut2(x)
{
    if(x.value=="")
    {
        x.value="Please type your ref no here";
    }
}

function fncClickText3(x)
{
    if (x.value=="Please type your email here")
    {
    x.value=""; 
    }
    
}
function fncClickOut3(x)
{
    if(x.value=="")
    {
        x.value="Please type your email here";
    }
}
// ==================================================================


