
function View_coolHouse(houseVal) 
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="304" height="190" id="dinohouse" align="middle">') ;
	document.write('<param name="movie" value="http://img1.dinokids.com/flash/dinohouse.swf?'+houseVal+'" />') ;
	document.write('<param name="quality" value="high" />') ;
	document.write('<param name="wmode" value="transparent" />') ;
	document.write('<param name="bgcolor" value="#2e3192" />') ;
	document.write('<embed src="http://img1.dinokids.com/flash/dinohouse.swf?'+houseVal+'" quality="high" wmode="transparent" bgcolor="#2e3192" width="304" height="190" name="dinohouse" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />') ;
	document.write('</object>') ;
}


function View_House(houseVal) 
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="410" height="257" id="dinohouse" align="middle">') ;
	document.write('<param name="movie" value="http://img1.dinokids.com/flash/dinohouse.swf?'+houseVal+'" />') ;
	document.write('<param name="quality" value="high" />') ;
	document.write('<param name="wmode" value="transparent" />') ;
	document.write('<param name="bgcolor" value="#2e3192" />') ;
	document.write('<embed src="http://img1.dinokids.com/flash/dinohouse.swf?'+houseVal+'" quality="high" wmode="transparent" bgcolor="#2e3192" width="410" height="257" name="dinohouse" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />') ;
	document.write('</object>') ;
}

function ViewRandProfile()
{
	var frm = document.dkForm ;
	frm.pMode.value = 'R' ;
	frm.action = "/kids/profile.php" ;
	frm.submit() ;
}

function ViewEditToday()
{
	var objStr = "editToday" ;
	var obj = document.getElementById(objStr);
	if (obj.style.display=="") {
		obj.style.display="none";
	} else {
		obj.style.display="";
	}
}

function MoveProfile( mode, dkid )
{
	var frm = document.dkForm ;
	frm.pMode.value = mode ;
//	frm.srchid.value = dkid ;
	frm.action = "/kids/profile.php?dkid="+dkid ;
	frm.submit() ;
}
function kidsHome()
{
	var frm = document.dkForm ;
	frm.action = "/kids/profile.php?dkid="+frm.srchid.value ;
	frm.submit() ;
}
function kidsBuddy()
{
	var frm = document.dkForm ;
	frm.action = "/kids/buddy.php?dkid="+frm.srchid.value ;
	frm.submit() ;
}
function kidsPhoto()
{
	var frm = document.dkForm ;
	frm.action = "/kids/photo.php?dkid="+frm.srchid.value ;
	frm.submit() ;
}

function srchDino()
{
	var srchFrm = document.dkForm ;
	if( !srchFrm.search.value || srchFrm.search.value=='' ) {
		document.getElementById('le_msg').innerHTML = "You must enter serarching account. <br> Please try again." ;
 		document.getElementById('kalert_pop').style.display= "" ;
		srchFrm.search.focus();
	} else {
		srchFrm.srchid.value = srchFrm.search.value ;
		srchFrm.action = "/kids/search.php" ;
		srchFrm.submit() ;
	}
}

$(function(){
	var frm = document.dkForm ;

	$("#pop_x").click(function(){
		document.getElementById('kalert_pop').style.display= "none" ;
		return false ;
	});
	$("#pop_ok").click(function(){
		document.getElementById('kalert_pop').style.display= "none" ;
		return false ;
	});

	$("#SearchID1").click(function(){
		if( !frm.search.value ) {
			document.getElementById('le_msg').innerHTML = "You must enter serarching account. <br> Please try again." ;
	 		document.getElementById('kalert_pop').style.display= "" ;
			frm.search.focus();
			return false ;
		} else {
			frm.srchid.value = frm.search.value ;
			frm.action = "/kids/search.php" ;
			frm.submit() ;
		}
		return false ;
	});

	$("#kidsLoginChk").click(function(){
//		var xCoord = (document.body.clientWidth-570)/2 ;
//		var yCoord = (document.body.clientHeight-400 )/2 ;
//		document.getElementById('kalert_pop').style.left= ""+xCoord+"px" ;
//		document.getElementById('kalert_pop').style.top= ""+yCoord+"px" ;

		if( !frm.uId.value ) {
			document.getElementById('le_msg').innerHTML = "You must enter your account. <br> Please try again." ;
			document.getElementById('kalert_pop').style.display= "" ;
			return false ;
		} else if( !frm.uPw.value ) {  
			document.getElementById('le_msg').innerHTML = "You must enter your password. <br> Please try again." ;
			document.getElementById('kalert_pop').style.display= "" ;
			return false ;
		} else {
			$.post("/lib/loginChk.php", {cmd:frm.cmd.value, id:frm.uId.value,pass:frm.uPw.value},
			function(data){
				var retVal = parseInt(data) ;
				switch( retVal ) {
					case 1 :
						window.location.href="/kids/" ;
						break;
					case 0 :
						document.getElementById('le_msg').innerHTML = "Your value is Empty. <br> Please try again." ;
						document.getElementById('kalert_pop').style.display= "" ;
						break;
					case 4 :
						document.getElementById('le_msg').innerHTML = "Your id need to talk with DinoKids. <br> Please Check your id. " ;
						document.getElementById('kalert_pop').style.display= "" ;
						break;
					case 3 :
						document.getElementById('le_msg').innerHTML = "Your password is wrong. <br> Please try again. " ;
						document.getElementById('kalert_pop').style.display= "" ;
						frm.uPw.value = '' ;
						break;
					case 2 :
						document.getElementById('le_msg').innerHTML = "Your account does not exist. <br> Please try again. " ;
						document.getElementById('kalert_pop').style.display= "" ;
						frm.uId.value = '';
						frm.uPw.value = '' ;
						break;
					default :
						document.getElementById('le_msg').innerHTML = "Error Happened.. <br> Please try again. " ;
						document.getElementById('kalert_pop').style.display= "" ;
						frm.uId.value = '';
						frm.uPw.value = '' ;
						break;
				}
			});
		}
		return false ;
	});
}) ;