
var hD="0123456789ABCDEF";
function d2h(d) {
var h = hD.substr(d&15,1);
while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
if (h.length < 2){return "0" + h;}
return h;
}

function clearif(form,txt)
{

if (form.caption.value== txt){
form.caption.value="";

}
}

function testfornull(form,txt)
{

if (form.caption.value== ""||form.caption.value==null){
alert(txt);
form.caption.focus();
return false;
}
return true;
}
function testfornullemail(form,txt)
{

if (form.email.value== ""||form.email.value==null){
alert(txt);
form.email.focus();
return false;
}
return true;
}
function testfornullname(form,txt)
{

if (form.name.value== ""||form.name.value==null){
alert(txt);
form.name.focus();
return false;
}
return true;
}

function testvolform(form)
{
if (testfornullemail(form,'Please enter your EMail address')) {
	if (testfornullname(form,'Please enter your name')){
		return true;}}
return false;
}

function h2d(h) {
var h1;

h1=parseInt(h,16);
if (h < 10){return "0" +h1;}
return h1;}

function crypt(name1) 

{
var j, Y = "00",t
offset = Math.floor(Math.random()*256)
Y +=d2h(offset)

if ( name1.length < 1 ) {return ""}

for (j=0 ; j < name1.length ; j++){
//document.write(name1.charCodeAt(j) + " ")
I=name1.charCodeAt(j) *1 + offset+j
while (I>255) {I=I-256;}
Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}
//document.write("<br>" + Y +"<br>" + name1 + "<br>" )
return Y
}

function uncrypt(name1) 

{
var j, Y = "y",t

if ( name1.length < 1 ) {return ""}

for (j=0 ; j < name1.length ; j++){
I=name1.substring(j,j+1) 
if (!((I>='0' && I<='9' ) || (I>='A' && I<='F' ))){
document.write(name1 )
return}}

code_version=h2d(name1.substring(0,2))
offset=h2d(name1.substring(2,4))

//document.write("<br>decrypt" + name1 + "=plain=")
for (j=4 ; j < name1.length ; j=j+2){
//document.write(name1.charCodeAt(j) + " ")
//I=name1.charCodeAt(j) *1
t_str =name1.substring(j,j+2)
chrcode=h2d(t_str)-offset-(j-4)/2
while (chrcode<0) {chrcode=chrcode+256;}
document.write(String.fromCharCode(chrcode))
Y = Y + String.fromCharCode(h2d(t_str))
// while (I>255) {I=I-256;}
//Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}

return Y
}


function suncrypt(name1) 

{
var j, Y = "",t

if ( name1.length < 1 ) {return ""}
for (j=0 ; j < name1.length ; j++){
I=name1.substring(j,j+1) 
if (!((I>='0' && I<='9' ) || (I>='A' && I<='F' ))){
return name1}}

code_version=h2d(name1.substring(0,2))
offset=h2d(name1.substring(2,4))

//document.write("<br>decrypt" + name1 + "=plain=")
for (j=4 ; j < name1.length ; j=j+2){
//document.write(name1.charCodeAt(j) + " ")
//I=name1.charCodeAt(j) *1
t_str =name1.substring(j,j+2)
chrcode=h2d(t_str)-offset-(j-4)/2
while (chrcode<0) {chrcode=chrcode+256;}
Y +=String.fromCharCode(chrcode)
// while (I>255) {I=I-256;}
//Y += d2h(I)
//Y += String.fromCharCode(j+offset+name1.charCodeAt(j))
}

return Y
}

function dcrypt(namestr)
{
t_str=crypt(namestr)
uncrypt(t_str)
}

