<?php
/*
dim accountID,accountName,ErrMsg
accountName = Session("accountName")
accountID = Session("accountID")

Function CleanStrForSQL(strInput)
	dim retval
	retval = ltrim(rtrim(strInput&""))
	retval = replace(retval,"'","''")
	CleanStrForSQL = retval
end function

Function StrToHTML(strInput)
	dim retval
	retval = ltrim(rtrim(strInput&""))
	retval = replace(retval,"&","&amp;")
	retval = replace(retval,"""","&quot;")
	retval = replace(retval,"'","&#180;")
	StrToHTML = retval
end function

Function clrHTML(strInput)
	dim retval
	retval = ltrim(rtrim(strInput&""))
	retval = Replace(Replace(retval,"'"," "),""""," ")
	retval = Replace(Replace(retval,"(",""),")","")
	clrHTML = retval
end function

Function IsValidEmail(strEmail)
	if InStr(strEmail, "@") > 0 and instr(strEmail, ".") > 0 Then 
		IsValidEmail = true
	else
		IsValidEmail = false
	end if
End Function

Function getState(stateCode)
dim retVal
retVal = ""
	if trim(stateCode) & "" <> "" then
		Set rs0 = Server.CreateObject("ADODB.Recordset")
		strSQL = "SELECT state_verbose FROM ma_states where state_code='" & uCase(trim(stateCode)) & "'"
		rs0.Open strSQL, Application("ConnectionString")
		if not rs0.EOF then
			retVal = trim(uCase(rs0("state_verbose")))
		end if
		rs0.Close
		set rs0=nothing	
	end if
	getState = retVal
End function
*/
function getIType($typeID)
{

$retVal = "";
	if(trim($typeID)!="")
	{

		$strSQLx = mysql_query("SELECT item_type FROM ma_itemtype where itemcode='".trim($typeID)."'");
		$rsc=@mysql_num_rows($strSQLx);
		if($rsc>0)
		{
			$rsx=@mysql_fetch_array($strSQLx);
			$retVal = trim($rsx["item_type"]);
		}
	}
	return($retVal);
}

function getSD($sdID)
{
$retVal = "";
	if(trim($sdID)!="")
	{
		$retVal="Any";
		$strSQLx = mysql_query("SELECT menu_name FROM tr_menu where menu_id='".trim($sdID)."'");
		$rsc=@mysql_num_rows($strSQLx);
		if($rsc>0)
		{
			$rsx=@mysql_fetch_array($strSQLx);
			$retVal = trim($rsx['menu_name']);
		}
		
	}
	return($retVal);
}

function getSchool($schlID)
{
	$retVal = "";
	if(trim($schlID)!="")
	{
		
		$strSQLx = mysql_query("SELECT school_name FROM tr_schools where school_id='".trim($schlID)."'");
		$rsc=@mysql_num_rows($strSQLx);
		if($rsc>0)
		{
			$rsx=@mysql_fetch_array($strSQLx);
			$retVal = trim($rsx['school_name']);
		}
		
	}
	return($retVal);
}
/*

Function getSchool(schlID)
dim retVal
retVal = ""
	if trim(schlID) & "" <> "" then
		Set rsx = Server.CreateObject("ADODB.Recordset")
		strSQLx = "SELECT school_name FROM tr_schools where school_id="& schlID
		set rsX = con.Execute(strSQLx)
		if not rsx.EOF then
			retVal = trim(rsx("school_name"))
		end if
		rsx.Close
		set rsx=nothing	
	end if
	getSchool = retVal
End function

Function getGrade(grdID)
dim retVal
retVal = ""
	if trim(grdID) & "" <> "" then
		Set rsx = Server.CreateObject("ADODB.Recordset")
		strSQLx = "SELECT grade_name FROM ma_grades where grade_id="& grdID
		set rsX = con.Execute(strSQLx)
		if not rsx.EOF then
			retVal = trim(rsx("grade_name"))
		end if
		rsx.Close
		set rsx=nothing	
	end if
	getGrade = retVal
End function

Function getTeacher(tchrID)
dim retVal
retVal = ""
	if trim(tchrID) & "" <> "" then
		Set rsx = Server.CreateObject("ADODB.Recordset")
		strSQLx = "SELECT teacher_name FROM tr_teachers where teacher_id="& tchrID
		set rsX = con.Execute(strSQLx)
		if not rsx.EOF then
			retVal = trim(rsx("teacher_name"))
		end if
		rsx.Close
		set rsx=nothing	
	end if
	getTeacher = retVal
End function

Function decrypt(str)
    Dim i, j, s
    s = ""
    j = Len(str)
    For i = 1 To j
      s = s & Chr(Asc(Mid(str, i, 1)) - (i * 2))
    Next
    decrypt = s
End Function

Function encrypt(str)
    Dim i, j, s
    j = Len(str)
    s = ""
    For i = 1 To j
      s = s & Chr(Asc(Mid(str, i, 1)) + (i * 2))
    Next
    encrypt = s
End Function

Function HexToAsc(inp)
    Dim outp, AscVal
    outp = ""
    For i = 1 To Len(inp)
        AscVal = "&H" & Mid(inp, i, 2)
        outp = outp & Chr(AscVal)
        i = i + 1
    Next
    HexToAsc = outp
End Function

Function AscToHex(inp)
    Dim outp, Hexval
    outp = ""
    For i = 1 To Len(inp)
        Hexval = Hex(Asc(Mid(inp, i, 1)))
        If Len(Hexval) = 1 Then
            outp = outp & "0" & Hexval
        Else
            outp = outp & Hexval
        End If
    Next
    AscToHex = outp
End Function

Function strRepInput(rVal)
	retval = ltrim(rtrim(rVal&""))
	retval = lcase(rVal)
	retval = Replace(Replace(retval," ","_"),"'","_")
	retval = Replace(Replace(retval,"(","_"),")","_")
	retval = Replace(Replace(retval,"&","_"),"/","_")
	retval = Replace(Replace(retval,"?","_"),"!","_")
	retval = Replace(Replace(retval,"@","_"),"#","_")
	retval = Replace(Replace(retval,"$","_"),"%","_")
	retval = Replace(Replace(retval,"^","_"),"*","_")
	strRepInput = retval
End Function%>

*/

?>