//Javascript
function StartMusic()
{
	var musicvalue=document.getElementById('hidmusic').value;
	if(musicvalue ==1)
	{
		document.frmmain.hidmusic.value=0;
		return false;
		
	}
	else 
	{
		document.frmmain.hidmusic.value=1;
		return true;
	}
}
function SelectPopup(itemNum)
{
	if(itemNum==1)
	{
		var file=document.getElementById('hidfile');
		filevalue=file.value;
		arrfilename=filevalue.split(",");
		url="popup.php?au="+arrfilename[0]+"&ag="+arrfilename[1];
		Popup(url);
	}
	if(itemNum==2)
	{
		url="music.html";
		Popup(url);
	}
}
function Popup(pageurl)
{
	var detect = navigator.userAgent.toLowerCase();
	var browser;
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('netscape')) browser = "Netscape Navigator"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else
	{
		 browser = "An unknown browser";
	}
	if(browser == "Netscape Navigator")
	{
		window.open(pageurl,'my_window','width=500,height=250,screenX=350,screenY=150,scrollbars=yes,resizable=yes');
	}
	else
	{
		window.open(pageurl,'my_window','width=500,height=250,left=350,top=125,scrollbars=yes,resizable=yes');
	}
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
}
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 movedown()
{
	if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+275))
	crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
	else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
	crossobj.top-=speed
	movedownvar=setTimeout("movedown()",20)
}
function moveup()
{
	if (iens6&&parseInt(crossobj.style.top)<=0)
	crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"
	else if (ns4&&crossobj.top<=0)
	crossobj.top+=speed
	moveupvar=setTimeout("moveup()",20)
}
function getcontent_height()
{
	if (iens6)
	contentheight=crossobj.offsetHeight
	else if (ns4)
	document.nscontainer.document.nscontent.visibility="show"
}
function stopscroll()
{
	if (window.moveupvar) clearTimeout(moveupvar)
	if (window.movedownvar) clearTimeout(movedownvar)
}
function CallConstruct()
{
	location.href="construct.html";
}
function Openlist(filename,dir)
{
	url="camlist.php?f="+filename+"&d="+dir;
	Popup(url);
}
/*****************************************************Kid Registration ***********************************************/
// --------------------------------------------
//                  trim
// Trim leading/trailing whitespace off string
// --------------------------------------------

function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}
/****************Email Validation */
function validateEmail (tfld)
{
  var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/  ;
  if (!email.test(tfld)) 
  {
    alert("Please enter a valid email address");
    doc.email.focus();
    return false;
  }
  var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/  ;
  if (!email2.test(tfld)) 
  {
    alert("Unusual e-mail address - check if correct");
	doc.email.focus();
 }
  return true;
}
/******************Check if field is empty *******************/
function IsEmpty(fieldName)
{
	var fvalue=trim(document.getElementById(fieldName).value);
	if(fvalue=="")
	{
		setfocus(valfield);
		alert("Enter data !!");
	}
}
/**********Checks Alphanumeric **********/
function ChecksAlphanumeric(str)
{
	//Pattern for Non AplhaNumerals ie Non Alphabets and Non digits
	var pattern=/\W/;
	if (str.search(pattern) == -1) //if match failed
		return true;
	else
		return false;

}
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;
   
 }

/***********Main function*/
function validateUserReg()
{
	doc = document.regForm;
	//User Name
	var field1 = document.forms['regForm'].elements['txtUser'];
	var uname = Trim(field1.value);
	strUName= uname.toString();
	
	var lenStr=strUName.length;
	//Password
	var field2 = document.forms['regForm'].elements['txtPwd'];
	var pwd = Trim(field2.value);
	strPwd= pwd.toString();
	//Retype Password
	var field3 = document.forms['regForm'].elements['txtRePwd'];
	var repwd = Trim(field3.value);
	strRePwd = repwd.toString();
	//File Avatar
	var field4 = document.forms['regForm'].elements['yourAvatar'];
	var fileAv = Trim(field4.value);
	//Email
	var field5 = document.forms['regForm'].elements['email'];
	var emailtxt = Trim(field5.value);
	//Name
	var field6 = document.forms['regForm'].elements['txtName'];
	var name = Trim(field6.value);
	strName= name.toString();
	//Age
	var field7 = document.forms['regForm'].elements['txtAge'];
	var age = Trim(field7.value);
	//Sex
	var field8 = document.forms['regForm'].elements['radSex'];
	var radCount = doc.radSex.length;
	//City
	var field9 = document.forms['regForm'].elements['txtCity'];
	var city = Trim(field9.value);
	//State
	var field10 = document.forms['regForm'].elements['txtState'];
	var state = Trim(field10.value);
	//Phone
	var field11 = document.forms['regForm'].elements['txtPhone'];
	var phone = Trim(field11.value);
	//Pain Problem
	var field12 = document.forms['regForm'].elements['txtProb'];
	var prob = Trim(field12.value);
	//default Avatar
	var field13 = document.forms['regForm'].elements['ourAvatar'];
	var ourAv = Trim(field13.value);
	//Anti Spam Graphics
	var field14 = document.forms['regForm'].elements['graphics'];
	var graphic = Trim(field14.value);
	
	if(strUName == "")
	{
		alert("Please enter your Fake Name.");
		doc.txtUser.focus();
		return false;
	}
	if(lenStr < 6)
	{
		alert("Your Fake Name should have minimum 6 characters!!");
		doc.txtUser.focus();
		return false;
	}
	if(ChecksAlphanumeric(strUName) == false)
	{
		alert("Your Fake Name should have only alphabets A-Z(both cases) and digits 0-9!!");
		doc.txtUser.focus();
		return false;
	} //End of User Name
	if(pwd == "")
	{
		alert("Please enter your Password.");
		doc.txtPwd.focus();
		return false;
	}
	if(strPwd.length < 6)
	{
		alert("Your Password should have minimum 6 characters!!");
		doc.txtPwd.focus();
		return false;
	}
	if(ChecksAlphanumeric(strPwd) == false)
	{
		alert("Your Password should have only alphabets A-Z(both cases) and digits 0-9 !!");
		doc.txtPwd.focus();
		return false;
	}
	if(strPwd != strRePwd)
	{
		alert("Password mismatch!! Please retype password correctly.");
		doc.txtRePwd.value = "";
		doc.txtRePwd.focus();
		return false;
	}
	if((fileAv == "")&&(ourAv == ""))
	{
		alert("Select an Avatar");
		//doc.fileAvtar.focus();
		return false;
	}
	if(strName == "")
	{
		alert("Please enter your Name");
		doc.txtName.focus();
		return false;
	}
	if(age =="")
	{
		alert("Enter your Age");
		doc.txtAge.focus();
		return false;
	}
	if(IsNumeric(age) == false)
	{
		alert("Error in Age!!");
		doc.txtAge.focus();
		return false;
	}		
	if(city=="")
	{
		alert("You should enter City");
		doc.txtCity.focus();
		return false;							
	}
	if(state=="")
	{
		alert("You should enter State");
		doc.txtState.focus();
		return false;
	}
	if(validateEmail(emailtxt) == false)
	{
	
		doc.email.focus();
		return false;
	}
	if(IsNumeric(phone) == false)
	{
		alert("Error in Phone Number");
		doc.txtPhone.focus();
		return false;
	}
	if(prob=="")
	{
		alert("Please enter your Pain Problem");
		doc.txtProb.focus();
		return false;
	}
	if(graphic=="")
	{
		alert("Please enter the exact letters from the image given below");
		doc.graphics.focus();
		return false;
	}
}
function validateParentReg()
{
	doc = document.regForm;
	//User Name
	var field1 = document.forms['regForm'].elements['txtUser'];
	var uname = Trim(field1.value);
	strUName= uname.toString();
	
	var lenStr=strUName.length;
	//Password
	var field2 = document.forms['regForm'].elements['txtPwd'];
	var pwd = Trim(field2.value);
	strPwd= pwd.toString();
	//Retype Password
	var field3 = document.forms['regForm'].elements['txtRePwd'];
	var repwd = Trim(field3.value);
	strRePwd = repwd.toString();
	
	var field4 = document.forms['regForm'].elements['txtName'];
	var name = Trim(field4.value);
	strName= name.toString();
	
	var field5 = document.forms['regForm'].elements['email'];
	var emailtxt = Trim(field5.value);
	
	//City
	var field9 = document.forms['regForm'].elements['txtCity'];
	var city = Trim(field9.value);
	//State
	var field10 = document.forms['regForm'].elements['txtState'];
	var state = Trim(field10.value);
	//Phone
	var field11 = document.forms['regForm'].elements['txtPhone'];
	var phone = Trim(field11.value);
	//Name
	var field6 = document.forms['regForm'].elements['txtChName'];
	var chname = Trim(field6.value);
	strChName= name.toString();
	//Age
	var field7 = document.forms['regForm'].elements['txtAge'];
	var age = Trim(field7.value);
	//Sex
	var field8 = document.forms['regForm'].elements['radSex'];
	var radCount = doc.radSex.length;
	//Pain Problem
	var field12 = document.forms['regForm'].elements['txtProb'];
	var prob = Trim(field12.value);
	//Anti Spam Graphics
	var field14 = document.forms['regForm'].elements['graphics'];
	var graphic = Trim(field14.value);
	
	if(strName == "")
	{
		alert("Please enter your Name");
		doc.txtName.focus();
		return false;
	}
	if(city=="")
	{
		alert("You should enter City");
		doc.txtCity.focus();
		return false;							
	}
	if(state=="")
	{
		alert("You should enter State");
		doc.txtState.focus();
		return false;
	}
	if(validateEmail(emailtxt) == false)
	{
	
		doc.email.focus();
		return false;
	}
	if(IsNumeric(phone) == false)
	{
		alert("Error in Phone Number");
		doc.txtPhone.focus();
		return false;
	}
	if(strChName == "")
	{
		alert("Please enter your Child's Name");
		doc.txtChName.focus();
		return false;
	}
	if(age =="")
	{
		alert("Enter your Child's Age");
		doc.txtAge.focus();
		return false;
	}
	if(IsNumeric(age) == false)
	{
		alert("Error in Age!!");
		doc.txtAge.focus();
		return false;
	}		
	
	if(prob=="")
	{
		alert("Please enter your Child's Pain Problem");
		doc.txtProb.focus();
		return false;
	}
	if(strUName == "")
	{
		alert("Please enter your Fake Name.");
		doc.txtUser.focus();
		return false;
	}
	if(lenStr < 6)
	{
		alert("Your Fake Name should have minimum 6 characters!!");
		doc.txtUser.focus();
		return false;
	}
	if(ChecksAlphanumeric(strUName) == false)
	{
		alert("Your Fake Name should have only alphabets A-Z(both cases) and digits 0-9!!");
		doc.txtUser.focus();
		return false;
	} //End of User Name
	if(pwd == "")
	{
		alert("Please enter your Password.");
		doc.txtPwd.focus();
		return false;
	}
	if(strPwd.length < 6)
	{
		alert("Your Password should have minimum 6 characters!!");
		doc.txtPwd.focus();
		return false;
	}
	if(ChecksAlphanumeric(strPwd) == false)
	{
		alert("Your Password should have only alphabets A-Z(both cases) and digits 0-9 !!");
		doc.txtPwd.focus();
		return false;
	}
	if(strPwd != strRePwd)
	{
		alert("Password mismatch!! Please retype password correctly.");
		doc.txtRePwd.value = "";
		doc.txtRePwd.focus();
		return false;
	}
	
	if(graphic=="")
	{
		alert("Please enter the exact letters from the image given below");
		doc.graphics.focus();
		return false;
	}
}
function validateParentProfile()
{
	doc = document.regForm;
	
	
	var field4 = document.forms['regForm'].elements['txtName'];
	var name = Trim(field4.value);
	strName= name.toString();
	
	var field5 = document.forms['regForm'].elements['email'];
	var emailtxt = Trim(field5.value);
	
	//City
	var field9 = document.forms['regForm'].elements['txtCity'];
	var city = Trim(field9.value);
	//State
	var field10 = document.forms['regForm'].elements['txtState'];
	var state = Trim(field10.value);
	//Phone
	var field11 = document.forms['regForm'].elements['txtPhone'];
	var phone = Trim(field11.value);
	//Name
	var field6 = document.forms['regForm'].elements['txtChName'];
	var chname = Trim(field6.value);
	strChName= name.toString();
	//Age
	var field7 = document.forms['regForm'].elements['txtAge'];
	var age = Trim(field7.value);
	//Sex
	var field8 = document.forms['regForm'].elements['radSex'];
	var radCount = doc.radSex.length;
	//Pain Problem
	var field12 = document.forms['regForm'].elements['txtProb'];
	var prob = Trim(field12.value);
	
	
	if(strName == "")
	{
		alert("Please enter your Name");
		doc.txtName.focus();
		return false;
	}
	if(city=="")
	{
		alert("You should enter City");
		doc.txtCity.focus();
		return false;							
	}
	if(state=="")
	{
		alert("You should enter State");
		doc.txtState.focus();
		return false;
	}
	if(validateEmail(emailtxt) == false)
	{
	
		doc.email.focus();
		return false;
	}
	if(IsNumeric(phone) == false)
	{
		alert("Error in Phone Number");
		doc.txtPhone.focus();
		return false;
	}
	if(strChName == "")
	{
		alert("Please enter your Child's Name");
		doc.txtChName.focus();
		return false;
	}
	if(age =="")
	{
		alert("Enter your Child's Age");
		doc.txtAge.focus();
		return false;
	}
	if(IsNumeric(age) == false)
	{
		alert("Error in Age!!");
		doc.txtAge.focus();
		return false;
	}		
	
	if(prob=="")
	{
		alert("Please enter your Child's Pain Problem.");
		doc.txtProb.focus();
		return false;
	}
	
}

function LoadUserReg()
{
	doc = document.regForm;
	doc.txtUser.focus();
}
function LoadParentReg()
{
	doc = document.regForm;
	doc.txtName.focus();
}
//--------Common Functions used to trim a string-----------------------------------//

// Trims all spaces to the left of a specific string
function LTrim(str)
{
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...
            var j=0, i = s.length;
            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;
            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }
        return s;
}
// Trims all spaces to the right of a specific string
function RTrim(str)
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in whitespace
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...
            var i = s.length - 1;       // Get length of string
            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;
            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }
        return s;
}
                                                                                                                        
// Trims all spaces to the left and right of a specific string by calling RTim
// and LTrim
function Trim(str)
{
        return RTrim(LTrim(str));
}

function ShowOurAvatar(visible,cnt)
{
	if(visible == 1)
	{
		//document.getElementById("dispAvatar").style.display="none";
		document.getElementById("avatar").style.display='';
		document.getElementById("avatar").style.border =  "1 ridge red";
		ViewAvatars(cnt);
	}
	else
	{
		document.getElementById("avatar").style.display="none";
		
		document.regForm.ourAvatar.value = "";
		document.regForm.ourAvatarCol.value = "";
	}
	//alert("Linda");
}
function SelectOurAvatar(name,col,cnt)
{
	col_id = "col"+col;
	document.regForm.ourAvatar.value = name;
	document.regForm.ourAvatarCol.value = col;
	HideAvatars(cnt);
	img_name = "AvImg"+col;
	document.getElementById(img_name).style.display = '';
	document.getElementById(col_id).style.display = '';
	document.getElementById(img_name).style.border=  "ridge red";
	document.getElementById("avatar").style.border=  "none";
}
function ShowOurAvatar1(visible,cnt)
{
	if(visible == 1)
	{
		//document.getElementById("dispAvatar").style.display="none";
		document.getElementById("avatartemp").style.display='';
		document.getElementById("avatartemp").style.border =  "1 ridge red";
		ViewAvatars(cnt);
	}
	else
	{
		document.getElementById("avatartemp").style.display="none";
		
		document.frmChgAvatar.ourAvatar.value = "";
		document.frmChgAvatar.ourAvatarCol.value = "";
	}
	//alert("Linda");
}
function SelectOurAvatar1(name,col,cnt)
{
	col_id = "col"+col;
	document.frmChgAvatar.ourAvatar.value = name;
	document.frmChgAvatar.ourAvatarCol.value = col;
	HideAvatars(cnt);
	img_name = "AvImg"+col;
	document.getElementById(img_name).style.display = '';
	document.getElementById(col_id).style.display = '';
	document.getElementById(img_name).style.border=  "ridge red";
	document.getElementById("avatartemp").style.border=  "none";
}
function HideAvatars(cnt)
{
	document.getElementById("avatarhead").style.display = "none";
	for(i=0; i< cnt ; i++)
	{
		//img_name = i+".jpg";
		img_name = "AvImg"+i;
		document.getElementById(img_name).style.display = 'none';
		document.getElementById(img_name).style.border = 'none';
		col_name = "col"+i;
		document.getElementById(col_name).style.display = 'none';
	}
	/*for(j=0; j< cnt ; j++)
	{
		col_name = "col"+j;
		document.getElementById(col_name).style.display = 'none';
	}*/
}
function ViewAvatars(cnt)
{
	document.getElementById("avatarhead").style.display = '';
	for(i=0; i<cnt ; i++)
	{
		//img_name = i+".jpg";
		img_name = "AvImg"+i;
		document.getElementById(img_name).style.display = '';
		col_name = "col"+i;
		document.getElementById(col_name).style.display = '';
	}
	/*for(j=0; j< cnt ; j++)
	{
		col_name = "col"+j;
		document.getElementById(col_name).style.display = '';
	}*/
}

function validateLoginForm()
{
	doc =document.frmKidLogin;
	//doc = document.regForm;
	//User Name
	var field1 = document.forms['frmKidLogin'].elements['uname'];
	var uname1 = Trim(field1.value);
	//Password
	var field2 = document.forms['frmKidLogin'].elements['pwd'];
	var pwd1 = Trim(field2.value);
	
	
	if(uname1 == "")
	{
		alert("Please enter your Fake Name.");
		doc.uname.focus();
		return false;
	}
	if(pwd1 == "")
	{
		alert("Please enter your Password");
		doc.pwd.focus();
		return false;
	}
}

function validatePostMessage()
{
	var msg = Trim(document.frmMsgPost.msg_txt.value);
	if( msg == "")
	{
		alert( 'Please enter your message' );
		document.frmMsgPost.msg_txt.value = "";
		document.frmMsgPost.msg_txt.focus();
		return false;
	}
	var pattern = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/  ;
  if (!email2.test(tfld)) 
  {
    alert("Unusual e-mail address - check if correct");
	doc.email.focus();
 }
	return true;
}

function focusMsgForm()
{
	document.frmMsgPost.msg_txt.focus();
	return true;
}
function validateProfile()
{
	doc = document.regForm;
	//User Name
	//Email
	var field5 = document.forms['regForm'].elements['email'];
	var emailtxt = Trim(field5.value);
	//Name
	var field6 = document.forms['regForm'].elements['txtName'];
	var name = Trim(field6.value);
	strName= name.toString();
	//Age
	var field7 = document.forms['regForm'].elements['txtAge'];
	var age = Trim(field7.value);
	//Sex
	var field8 = document.forms['regForm'].elements['radSex'];
	var radCount = doc.radSex.length;
	//City
	var field9 = document.forms['regForm'].elements['txtCity'];
	var city = Trim(field9.value);
	//State
	var field10 = document.forms['regForm'].elements['txtState'];
	var state = Trim(field10.value);
	//Phone
	var field11 = document.forms['regForm'].elements['txtPhone'];
	var phone = Trim(field11.value);
	//Pain Problem
	var field12 = document.forms['regForm'].elements['txtProb'];
	var prob = Trim(field12.value);
	
	
	
	if(strName == "")
	{
		alert("Please enter your Name");
		doc.txtName.focus();
		return false;
	}
	if(age =="")
	{
		alert("Enter your Age");
		doc.txtAge.focus();
		return false;
	}
	if(IsNumeric(age) == false)
	{
		alert("Error in Age!!");
		doc.txtAge.focus();
		return false;
	}		
	if(city=="")
	{
		alert("You should enter City");
		doc.txtCity.focus();
		return false;							
	}
	if(state=="")
	{
		alert("You should enter State");
		doc.txtState.focus();
		return false;
	}
	if(validateEmail(emailtxt) == false)
	{
	
		doc.email.focus();
		return false;
	}
	if(IsNumeric(phone) == false)
	{
		alert("Error in Phone Number");
		doc.txtPhone.focus();
		return false;
	}
	if(prob=="")
	{
		alert("Please enter your Pain Problem");
		doc.txtProb.focus();
		return false;
	}
	
}
function validatePassword()
{
	doc = document.frmChgPwd;
	
	//Password
	var field1 = document.forms['frmChgPwd'].elements['txtOldPwd'];
	var oldpwd = Trim(field1.value);
	strOldPwd= oldpwd.toString();
	//Password
	var field2 = document.forms['frmChgPwd'].elements['txtPwd'];
	var pwd = Trim(field2.value);
	strPwd= pwd.toString();
	//Retype Password
	var field3 = document.forms['frmChgPwd'].elements['txtRePwd'];
	var repwd = Trim(field3.value);
	strRePwd = repwd.toString();
	
	//Password
	var field4 = document.forms['frmChgPwd'].elements['OldPwd'];
	var oldpwd1 = Trim(field4.value);
	strOldPwd1= oldpwd1.toString();
	
	if(oldpwd == "")
	{
		alert("Please enter your Old Password.");
		doc.txtOldPwd.focus();
		return false;
	}
	/*if(strOldPwd != strOldPwd1)
	{
		alert("Please enter your valid Old Password.");
		doc.txtOldPwd.focus();
		return false;
	}*/
	
	if(pwd == "")
	{
		alert("Please enter your New Password.");
		doc.txtPwd.focus();
		return false;
	}
	if(strPwd.length < 6)
	{
		alert("Your Password should have minimum 6 characters!!");
		doc.txtPwd.focus();
		return false;
	}
	if(ChecksAlphanumeric(strPwd) == false)
	{
		alert("Your Password should have only alphabets A-Z(both cases) and digits 0-9 !!");
		doc.txtPwd.focus();
		return false;
	}
	if(repwd == "")
	{
		alert("Password mismatch!! Please retype password correctly.");
		doc.txtRePwd.value = "";
		doc.txtRePwd.focus();
		return false;
	}
	if(strPwd != strRePwd)
	{
		alert("Password mismatch!! Please retype password correctly.");
		doc.txtRePwd.value = "";
		doc.txtRePwd.focus();
		return false;
	}
	
}
function getposOffset(overlay, offsettype)
{
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function overlay(curobj, subobjstr, opt_position)
{
	if (document.getElementById)
	{
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		return false
	}
	else
		return true
}
function overlayclose(subobj)
{
	document.getElementById(subobj).style.display="none"
}
function validatePostMessage()
{
	var msg = Trim(document.frmMsgPost.msg_txt.value);
	if( msg == "")
	{
		alert( 'Please enter your message' );
		document.frmMsgPost.msg_txt.value = "";
		document.frmMsgPost.msg_txt.focus();
		return false;
	}
	
}

function focusMsgForm()
{
	document.frmMsgPost.msg_txt.focus();
	return true;
}


function closeRelpy(id,status)
{
	if(status == 0)
	{
		document.getElementById("divParent"+id).style.display="none";
		//document.getElementById("div1").style.display="none";
		document.getElementById("divView"+id).style.display= "block";
		document.getElementById("divClose"+id).style.display="none";
	}
	if(status == 1)
	{
		document.getElementById("divParent"+id).style.display= "block";
		//document.getElementById("div1").style.display="block";
		document.getElementById("divView"+id).style.display= 'none';
		document.getElementById("divClose"+id).style.display= "block";
	}
	
}

function forgetPass(category)
{
	var detect = navigator.userAgent.toLowerCase();
	var field1 = document.forms['frmKidLogin'].elements['uname'];
	var uname1 = Trim(field1.value);
	var browser;
	var pageurl = "forgetpassword.php?c="+category+"&u="+uname1;
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('netscape')) browser = "Netscape Navigator"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else
	{
		 browser = "An unknown browser";
	}
	if(browser == "Netscape Navigator")
	{
		window.open(pageurl,'my_window','width=350,height=250,screenX=350,screenY=150,scrollbars=no');
	}
	else
	{
		window.open(pageurl,'my_window','width=350,height=250,left=350,top=125,scrollbars=no');
	}
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
}
function validatePass()
{
	doc= document.frmKidLogin;
	var field1 = document.forms['frmKidLogin'].elements['uname'];
	var uname1 = Trim(field1.value);
		
	if(uname1 == "")
	{
		alert("Please enter your Fake Name.");
		doc.uname.focus();
		return false;
	}
}

