
function $(v){
return document.getElementById(v);}
function $si(id){
return $(id).selectedIndex;}
function $ih(id){
return $(id).innerHTML;}
function $s(id,t){
$(id).innerHTML=t;}
function $v(id,t){
$(id).value=t;}
function $gv(id){
return $(id).value;}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};
function alertContents(hR,id){
try{
if(hR.readyState==4){
if(hR.status==200){
$s(id,"<img alt=\"Loding...\" src=\"http://img1.crazyfriendz.com/load.gif\" /> Loading...");
$s(id,hR.responseText);}else{
$s(id,"Access Denied...");}}}catch(e){}}
var req="request/ckav.aspx?usr=";
function mR(id,url){
var hR;
if(window.XMLHttpRequest){
hR=new XMLHttpRequest;
if(hR.overrideMimeType){
hR.overrideMimeType("text/xml");}}else if(window.ActiveXObject){
try{
hR=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){
try{
hR=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!hR){
alert("Givingup:(Cannot create an XMLHTTP instance");
return false;}
if(id==""){
hR.open("POST",url,true);
hR.send("");}else{
hR.onreadystatechange=function(){alertContents(hR,id);};
hR.open("GET",url,true);
hR.send(null);}}
function checkleapyear(y){
y=parseInt(y);
if(y%4==0){
if(y%100!=0){
return true;}else{
if(y%400==0){
return true;}else{
return false;}}}
return false;}
function change(){
var i=0;
var monthDropdown=$("mon");
var dayDropdown=$("day");
dayDropdown.selectedIndex=-1;
var daysInMonth=[0,31,28,31,30,31,30,31,31,30,31,30,31];
var month=monthDropdown.selectedIndex;
for(i=1;i<=daysInMonth[month];++i){
dayDropdown[i-1]=null;}
dayDropdown.selectedIndex=-1;
for(i=1;i<=daysInMonth[month];++i){
dayDropdown[i-1]=new Option(i.toString());}
changedate();}
function changedate(){
if(checkleapyear($("year").options[$("year").selectedIndex].innerHTML)&&
$("mon").selectedIndex==2){
if($("day").length<29){
$("day")[$("day").length]=new Option("29");}}else{
if($("day").length==29){
$("day").remove(28);}}
$("dat").value=$("mon").selectedIndex+"/"+($("day").selectedIndex+1)+"/"+$("year").options[$("year").selectedIndex].innerHTML;
bdate();}
function bdate(){
if($("mon").selectedIndex!=0&&
$("dat").value.indexOf("day")==-1&&
$("dat").value.indexOf("year")==-1){
$("bdt").innerHTML="";}else{
$("bdt").innerHTML="<br/>Birthdate not set...";
ie=0;
password+="b";}}
var l=location.href;
var t=location.pathname;
function com(v1,v2){
if(v1!=v2){
$v(v1,v2);}}
if(l.indexOf("msg")==-1){
l=l.substr(l.indexOf(t)+t.length+1);
l=l.split("=");
l=unescape(l.join(",").split("&").join(","));
var k=l.split(",");
l="firstname,lastname,email,hometown".split(",");
for(i=0;i<k.length;i++){
k.splice(i,1);}
if(k.length!=0){
com(l[0],k[0]);
com(l[1],k[1]);
com(l[2],k[2]);
com(l[3],k[3]);}
var ie,password;
$v("js","1");}
function validate(thi,msg,want){
pn=thi.parentNode.id;
if($gv(thi.id).trim()==""){
error(pn,msg+" required...",thi.id);
ie=0;}else{
error(pn,"",thi.id);
if(thi.id=="pass"){
if($gv(thi.id).trim().length<7){
error(pn,"Password length must be more then 7...",thi.id);
ie=0;
password+="pa";}else{
error(pn,"",thi.id);}}
if(thi.id=="email"){
validEmail(thi,pn);}}
if(thi.id=="username"){
validuser(thi,pn,want);}}
function validuser(thi,pn,want){
ctrl=$gv(thi.id).trim();
if(ctrl.length>4){
error(pn,"",thi.id);
test_user=/^[0-9a-z.-_]+$/i;
if(!test_user.test(ctrl)||
ctrl.indexOf("@")>-1||
ctrl.indexOf(";")>-1||
ctrl.indexOf(";")>-1||
ctrl.indexOf("/")>-1||ctrl.indexOf("?")>-1){
error(pn,"Only (0-9), (a-z), ( _ ) and (.) Allow...",thi.id);
ie=0;
$s("usr","");}else{
error(pn,"",thi.id);
if(!want)
mR("usr",req+ctrl);}}else{
error(pn,"username must be between 5 to 25...",thi.id);
$s("usr","");
ie=0;
password+="u";}}
function validEmail(thi,pn){
email=$gv(thi.id).trim();
test_email=/^[0-9a-z.-_]+(@)+[0-9a-z._-]+\.[a-z]{2,4}$/i;
if(!test_email.test(email)||
email.lastIndexOf("@")!=email.indexOf("@")){
error(pn,"Provide Valid email-id...",thi.id);
ie=0;
password+="e";}else{
error(pn,"",thi.id);}}
function error(id,msg,tid){
if(msg!=""){
var ih=$ih(id),v=$gv(tid);
if(ih.indexOf("err"+id)==-1){
ih+=$gv("err").replace("{id}","err"+id);
$s(id,ih);
$v(tid,v);
$(tid).focus();}}
try{
$s("err"+id,msg);}catch(e){}}
function vR(){
m=$("male");
f=$("female");
if(m.checked||f.checked){
if(m.checked){
$("gen").value="male";}else{
$("gen").value="female";}
$("errgen").innerHTML="";}else{
$("errgen").innerHTML="<br/>Gender Required...";
ie=0;
password+="g";}}
function ckall(){
ie=1;
validate($("username"),"Username",true);
validate($("firstname"),"Firstname");
validate($("lastname"),"Lastname");
validate($("email"),"Email-ID");
validate($("pass"),"Password");
vR();
if($gv("cpass").trim()!=$gv("pass").trim()){
error("cp","password and confirm password are not same...",$("cpass").id);
password="p";
ie=0;}else{
error("cp","",$("cpass").id);}
validate($("nationality"),"Nationality");
validate($("hometown"),"Hometown");
if($si("ques")==0){
error("sq","Security Question required...","ques");
ie=0;
password+="q";}else{
error("sq","","ques");}
if($si("ques")==6&&$gv("ownquestion").trim()==""){
error("san","Security Question required...","ownquestion");
ie=0;
password+="oq";}else{
error("san","","ownquestion");}
validate($("sa"),"Security answer");
if($gv("code")!=$("captcha").getAttribute("code")){
error("cd","security code is not correct...","code");
ie=0;
password+="c";}else{
error("cd","","code");}
if(!$("ck").checked){
error("acpt","Accept term and condition to create account...","firstname");
ie=0;
password+="ck";}else{
error("acpt","","firstname");}
changedate();
bdate();
if(ie==0){
return false;}
if($si("ques")>0&&$si("ques")<6){
$v("sques",$gv("ques"));}else{
$v("sques",$gv("ownquestion"));}
return true;}
function changepic(){
mR("cap","request/request.aspx?code=captcha&pre="+$("captcha").getAttribute("code"));}
var m={h:function(id){$(id).style.display="none";},s:function(id){$(id).style.display="block";},gv:function(id){return $(id).value;},w:function(id,t){try{$(id).innerHTML=t;}catch(e){}},v:function(id,t){$(id).value=t;}};
var o={t:function(id,v){$(id).style.top=v+"px";},l:function(id,v){$(id).style.left=v+"px";},h:function(id,v){$(id).style.height=v+"px";},w:function(id,v){$(id).style.width=v+"px";}};
function suggest(txtid,divid,urlcode,w)
{
var curleft=curtop=0;
var obj=$(txtid);
if(obj.offsetParent)
{
do
{
curleft+=obj.offsetLeft;
curtop+=obj.offsetTop;}
while(obj=obj.offsetParent);
curtop=curtop+$(txtid).offsetHeight;
o.t(divid,curtop);
o.w(divid,w);
o.l(divid,curleft);}
var str=escape(m.gv(txtid));
if(str!=''){$(divid).className='help';m.s(divid);
mR(divid,'request/detaillist.aspx?code='+urlcode+'&search='+str);}else{m.h(divid);}}
function shome(t){
m.v('hometown',t.innerHTML);
m.h('suggest');}
var gaJsHost="https:"==document.location.protocol?"https://ssl.":"http://www.";
document.write(unescape("%3Cscript src='"+gaJsHost+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));