// JavaScript Document
// JavaScript Document
function isValidURL(url){
   var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    } 
}


//-----------Added BY Raj

//added by raj

	
function commentcampaign(camp)
{
mywindow=window.open("member/campaigncomments.php?camp="+camp,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);

}
//added by raj 7/1/2009
function campaignopen(camp)
{
mywindow=window.open("takingcampaign.php?camp="+camp,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);

}

//added by raj 7/1/2009
function ratecampaign(camp)
{

mywindow=window.open("ratecampaign.php?camp="+camp,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);

}


function animate2()
{
   sec = 3;
	delay = sec*1000;
	document.getElementById('bt').disabled="disabled";
	document.getElementById("animation").style.display='block';
	setTimeout("submitform2()",delay);
	
}
function submitform2()
{
document.edit_form1.submit();
}

function commentopen(act)
{
mywindow=window.open("member/comments.php?act="+act,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);
}


function sendmsgopen(from,to)
{
mywindow=window.open("send_message.php?from="+from+"&to="+to,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);
}



function commentcauseopen(cause)
{
mywindow=window.open("member/causecomments.php?cause="+cause,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);
}

function commentgroupopen(gid)
{
mywindow=window.open("groupcomments.php?gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);
}

function uploadgroupimageopen(gid)
{
mywindow=window.open("uploadgroupimage.php?gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=150")
mywindow.moveTo(300,300);
}




function posttopicopen(gid)
{
mywindow=window.open("posttopic.php?gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=700, height=450")
mywindow.moveTo(200,300);
}


function posteventpopen(gid)
{
mywindow=window.open("postevent.php?gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=700, height=450")
mywindow.moveTo(200,300);
}

function editopen(postid)
{
mywindow=window.open("edittopic.php?postid="+postid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=700, height=450")
mywindow.moveTo(200,300);
}

function topiceditopen(tpid,gid)
{
mywindow=window.open("replytopic.php?tpid="+tpid+"&gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=700, height=450")
mywindow.moveTo(200,300);
}

function changecomment(chg)
{
mywindow=window.open("member/changecomments.php?chg="+chg,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=350")
mywindow.moveTo(200,300);

}



function actionopen(act)
{
mywindow=window.open("takingaction.php?act="+act,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);

}
function causeopen(cause)
{
mywindow=window.open("takingcause.php?cause="+cause,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);

}

function groupopen(gid)
{
mywindow=window.open("../takinggroup.php?gid="+gid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);

}

function changeopen(chg)
{
mywindow=window.open("takingchange.php?chg="+chg,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);
}

function instopen(act)
{
mywindow=window.open("joininstitute.php?act="+act,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=20")
mywindow.moveTo(200,300);

}


function rateopen(act)
{

mywindow=window.open("rateaction.php?act="+act,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);

}

function ratecause(cause)
{

mywindow=window.open("ratecause.php?cause="+cause,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);

}
//this function is used for donation created by manish 23-01-2009 
function donate(cause_id,cause_name)
{
mywindow=window.open("donatecause.php?cause_id="+cause_id+"&cause_name="+cause_name,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(300,300);
	
}

function volunteeropen(cause_id,cause_name){
mywindow=window.open("volunteer_apply.php?cause="+cause_id+"&cause_name="+cause_name,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=690, height=771")
mywindow.moveTo(200,200);
	
	
}

function donatediv(cause_id,cause_name)
{
var openstatus;
openstatus=document.getElementById('doante');
if(openstatus.style.display=="block")
{
openstatus.style.display="none";
}
else
{
openstatus.style.display="block";
}
}

function ratechange(chg)
{
mywindow=window.open("ratechange.php?chg="+chg,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);
}
<!-- Added by Manish for CSR Rating-->
function ratecsr(cat_id)
{
mywindow=window.open("ratecsr.php?cat_id="+cat_id,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);
}
//13-01-09
function ratevideo(videoid)
{
mywindow=window.open("ratevideo.php?videoid="+videoid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);
}
function ratephoto(videoid)
{
mywindow=window.open("ratephoto.php?videoid="+videoid,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=100")
mywindow.moveTo(200,300);
}
ratephoto
<!--end Manish-->

function validate5()
{
var fname=document.edit_form1.fname
var lname=document.edit_form1.lname

var gender=document.edit_form1.gender
var date=document.edit_form1.date
var month=document.edit_form1.month
var year=document.edit_form1.year
var city=document.edit_form1.city
var country=document.edit_form1.country


if(fname.value=="")
{
alert("Please enter your first name..!")
fname.focus()
return false
}

if(lname.value=="")
{
alert("Please enter your last name..!")
lname.focus()
return false
}

if(gender.value=="")
{
alert("Please select your gender..!")
gender.focus()
return false
}
else
{
}

if(date.value=="")
{
alert("Please select your date of birth..!")
date.focus()
return false
}

if(month.value=="")
{
alert("Please select your month of birth..!")
month.focus()
return false
}

if(year.value=="")
{
alert("Please select your year of birth..!")
year.focus()
return false
}

if(city.value=="")
{
alert("Please enter city..!")
city.focus()
return false
}
	 
if(country.value=="")
{
alert("Please enter country..!")
country.focus()
return false
}
animate2();
}



function validate6()
{
var email=document.reg_form1.email.value	
var pwd=document.reg_form1.pwd
var cpwd=document.reg_form1.cpwd

var fname=document.reg_form1.fname
var year=document.reg_form1.year
var country=document.reg_form1.countryinc
var legalstatus=document.reg_form1.legalstatus
var headcity=document.reg_form1.headcity
var headcountry=document.reg_form1.headcountry



if(email=="")
 {
	alert("Please enter your email ..!!!");
	document.reg_form1.email.focus();
	return false
	}
 if (document.reg_form1.email.value.length>0)
	{
 	i=document.reg_form1.email.value.indexOf("@")
 	j=document.reg_form1.email.value.indexOf(".",i)
 	k=document.reg_form1.email.value.indexOf(",")
 	kk=document.reg_form1.email.value.indexOf(" ")
 	jj=document.reg_form1.email.value.lastIndexOf(".")
	 len=document.reg_form1.email.value.length
	 if((i>0)&&(j>(1+1))&&(k==-1)&&(kk==-1)&&(len-jj>=2))
	 //&&(len-jj<=3))
	 {
	 //document.cform.ConfirmEmail.focus();//
	 }
	 else
	 {
	 alert("Please enter an exact email address.\n" + document.reg_form1.email.value + " is invalid.");
	document.reg_form1.email.focus();
	return false
	 }
	 } 


if(pwd.value=="")
{
alert("Please enter your password.!")
pwd.focus()
return false
}
if(cpwd.value!=pwd.value)
{
alert("Both password must be same..!")
cpwd.focus()
return false
}


if(fname.value=="")
{
alert("Please enter name..!")
fname.focus()
return false
}


if(year.value=="")
{
alert("Please select year of incorporation..!")
year.focus()
return false
}
	 
if(country.value=="")
{
alert("Please select country of incorporation..!")
countryinc.focus()
return false
}

if(document.getElementById("countryop[]").value=="")
{
alert("Please select country of operations")
document.getElementById("countryop[]").focus()
return false
}

if(legalstatus.value=="")
{
alert("Please select Legal Status..!")
legalstatus.focus()
return false
	
}

if(legalstatus.value=="Other")
{
var otherlegal= document.reg_form1.otherlegal	
if(otherlegal.value=="")
{
alert("Please enter your legal status")
otherlegal.focus()
return false
}
}

if(headcity.value=="")
{
alert("Please enter headquarter city..!")
headcity.focus()
return false
}

if(headcountry.value=="")
{
alert("Please enter headquarter country..!")
headcountry.focus()
return false
}

animate2();
}

function validate7()
{

//var nm=document.edit_form1.name;
var year=document.edit_form1.year
var country=document.edit_form1.countryinc
var legalstatus=document.edit_form1.legalstatus
var headcity=document.edit_form1.headcity
var headcountry=document.edit_form1.headcountry
var site=document.edit_form1.site
var mail=document.edit_form1.mail
/*if(nm.value="")
{
alert("Please enter name..!")
nm.focus()
return false
}
*/
if(year.value=="")
{
alert("Please select year of incorporation..!")
year.focus()
return false
}
	 
if(country.value=="")
{
alert("Please select country of incorporation..!")
countryinc.focus()
return false
}

if(document.getElementById("countryop[]").value=="")
{
alert("Please select country of operations")
document.getElementById("countryop[]").focus()
return false
}

if(legalstatus.value=="")
{
alert("Please select Legal Status..!")
legalstatus.focus()
return false
	
}

if(legalstatus.value=="Other")
{
var otherlegal= document.edit_form1.otherlegal	
if(otherlegal.value=="")
{
alert("Please enter your legal status")
otherlegal.focus()
return false
}
}

if(headcity.value=="")
{
alert("Please enter headquarter city..!")
headcity.focus()
return false
}

if(headcountry.value=="")
{
alert("Please enter headquarter country..!")
headcountry.focus()
return false
}

 if (mail.value.length>0)
	{
 	i=mail.value.indexOf("@")
 	j=mail.value.indexOf(".",i)
 	k=mail.value.indexOf(",")
 	kk=mail.value.indexOf(" ")
 	jj=mail.value.lastIndexOf(".")
	 len=mail.value.length
	 if((i>0)&&(j>(1+1))&&(k==-1)&&(kk==-1)&&(len-jj>=2))
	 //&&(len-jj<=3))
	 {
	 //document.cform.ConfirmEmail.focus();//
	 }
	 else
	 {
	 alert("Please enter an exact email address.\n" + mail.value + " is invalid.");
	mail.focus();
	return false
	 }
	 } 


animate2();
}

function openwin()
{
mywindow=window.open("uploadimage.php","_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=600, height=135")
mywindow.moveTo(200,300);
}

function upimage()
{
var id=document.edit_form1.member
if(id.value=="")
{
alert("Browse image");
id.focus()
return false
}
animate2();
}

function comment()
{
var cmt=document.edit_form1.cmt.value
if(cmt=="")
{
alert("Please enter your comments")
document.edit_form1.cmt.focus()
return false
}
animate2();
}

function message()
{
var msg=document.edit_form1.msg.value
if(trim(msg)=="")
{
alert("Please enter your message")
document.edit_form1.msg.focus()
return false
}
animate2();
}


function topic()
{
var subject=document.edit_form1.subject.value
var cmt=document.edit_form1.cmt.value
if(subject=="")
{
alert("Please enter subject of topic")
document.edit_form1.subject.focus()
return false
}

/*if(cmt=="")
{
alert("Please enter your comments")
document.edit_form1.cmt.focus()
return false
}*/
animate2();
}


function evente()
{
var subject=document.edit_form1.subject.value
var cmt=document.edit_form1.cmt.value
if(subject=="")
{
alert("Please enter subject of topic")
document.edit_form1.subject.focus()
return false
}

if(cmt=="")
{
alert("Please enter your comments")
document.edit_form1.cmt.focus()
return false
}
animate2();
}


function chk_invite()
{
var too=document.edit_form1.recipients.value
if(too=="")
{
alert("Please enter friends email")
document.edit_form1.recipients.focus()
return false
}
animate2();
}