document.write("<script type='text/javascript' src='scripts/misc.js'></"+"script>");

var lengthofNew=0;
var optionValues=new Array()
var newOptionValues;

//----------------------------------------------------------------------------------------------------------
//Script for adding/removing options to select boxes
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

function addOption(theSel, theText, theValue)
{
	
  var newOpt = new Option(theText, theValue);
  
  var selLength = theSel.length;
  theSel.options[selLength] = newOpt;
}

function deleteOption(theSel, theIndex)
{ 
  var selLength = theSel.length;
  if(selLength>0)
  {
    theSel.options[theIndex] = null;
  }
}

function moveOptions(theSelFrom, theSelTo,status)
{
  
  var selLength = theSelFrom.length;
  var lengthofNew = theSelTo.length;
  var selectedText = new Array();
  var selectedValues = new Array();
  var selectedCount = 0;
  var index;
  var i;
  
  // Find the selected Options in reverse order
  // and delete them from the 'from' Select.
  for(i=selLength-1; i>=0; i--)
  {
    if(theSelFrom.options[i].selected)
    {
	  index=i;	
      selectedText[selectedCount] = theSelFrom.options[i].text;
      selectedValues[selectedCount] = theSelFrom.options[i].value;
      deleteOption(theSelFrom, i);
      selectedCount++;
    }
  }
 
 
  for(i=selectedCount-1; i>=0; i--)
  {
    addOption(theSelTo, selectedText[i], selectedValues[i]);
	lengthofNew++;	
	
  }
  
 if(status==0) {
 	newOptionValues="";
    for(var j=0;j<lengthofNew;j++)
  		{
		
	  	optionValues[j]=theSelTo.options[j].value;
		newOptionValues+=theSelTo.options[j].value+",";
		
	  }
  } else if(status==1)
    {
		lengthofNew=theSelFrom.length;
		newOptionValues="";
    for(var j=0;j<lengthofNew;j++)
  		{
			
	  	optionValues[j]=theSelFrom.options[j].value;
		newOptionValues+=theSelFrom.options[j].value+",";
		 }
	}
   document.getElementById('newOptionValues').value=newOptionValues;
  
  theSelTo.focus=true;
  if(NS4) history.go(0);
}
//--------------------------------------------------/

var strRollColor = '#E1E1E1';

var strRowOneColor = '#969696';

var useHighlighting = true;

var strRowTwoColor = '#B4B4B4';

var strToggleColor = '#E1E1E1';

function editTradeTextPortion(id)
{
	var url="editTradeTextPortion.php?fid="+id
	var width=650;

	var height=350;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'EditIndex',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;
}

function validateScientificPresentationFields(actId){
	if(trim(document.getElementById("title").value).length==0){
		alert("Enter Title of the presentation")
		document.getElementById("title").focus()
		return false;
	}
	if(trim(document.getElementById("presenterName").value).length==0){
		alert("Enter Presenter’s Name:")
		document.getElementById("presenterName").focus()
		return false;
	}
	
	var typeOfcnt=trim(document.getElementById("typeOfcnt").value);
	var typecount=0;
	for(var i=1;i<=typeOfcnt;i++)
	{
		if(document.getElementById("typeOfScientificSession["+i+"]").checked==true){
			typecount=1;
		}
		
	}
	if(typecount==0)
	{
		alert("Enter Type Of Scientific Session")
		document.getElementById("action").focus()
		return false;
	}
	if(trim(document.getElementById("presentation").value)==0){
		alert("Enter presentation")
		document.getElementById("presentation").focus()
		return false;
	}
	var count=trim(document.getElementById("count").value);
	var authorcount=0;
	for(var i=0;i<count;i++)
	{
		if(trim(document.getElementById("authorName"+i).value).length>0){
			authorcount=1;
		}
		
	}
	if(authorcount==0)
	{
		if(trim(document.getElementById("authorName0").value).length==0){
			alert("Enter Author Name")
			document.getElementById("authorName0").focus()
			return false;
		}
	}
	if(trim(document.getElementById("name").value).length==0){
		alert("Enter Name")
		document.getElementById("name").focus()
		return false;
	}
	if(trim(document.getElementById("email").value).length==0){
		alert("Enter Email")
		document.getElementById("email").focus()
		return false;
	}
	var checkEmail=isEmail(document.getElementById("email").value);

	if(checkEmail==false){

		alert(" Enter a Valid Email");

		document.getElementById("email").focus();

		return false;

	}
	if(trim(document.getElementById("phone").value).length==0){
		alert("Enter Phone")
		document.getElementById("phone").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("phone").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("phone").focus();

			return false;

		}
	if(trim(document.getElementById("address").value).length==0){
		alert("Enter Address")
		document.getElementById("address").focus()
		return false;
	}
	if(trim(document.getElementById("pin").value).length==0){
		alert("Enter Pin/Zip number")
		document.getElementById("pin").focus()
		return false;
	}
	
}

function validateVisaApplicationFields(actId){
	if(trim(document.getElementById("name").value).length==0){
		alert("Enter Name")
		document.getElementById("name").focus()
		return false;
	}
	if(trim(document.getElementById("dob").value).length==0){
		alert("Enter Date of birth")
		document.getElementById("dob").focus()
		return false;
	}
	if(trim(document.getElementById("dob").value).length>0){
		if(!(isDate(trim(document.getElementById("dob").value))))
		{
			document.getElementById("dob").focus()
			return false;
		}
					
	}
	if(trim(document.getElementById("countryId").value).length==0){
		alert("Enter Country")
		document.getElementById("countryId").focus()
		return false;
	}
	if(trim(document.getElementById("passportNumber").value).length==0){
		alert("Enter Passport Number")
		document.getElementById("passportNumber").focus()
		return false;
	}
	if(trim(document.getElementById("issuedDate").value).length==0){
		alert("Enter Issued Date")
		document.getElementById("issuedDate").focus()
		return false;
	}
	if(trim(document.getElementById("issuedDate").value).length>0){
		if(!(isDate(trim(document.getElementById("issuedDate").value))))
		{
			document.getElementById("issuedDate").focus()
			return false;
		}
					
	}
	if(trim(document.getElementById("expiryDate").value).length==0){
		alert("Enter Expiry Date")
		document.getElementById("expiryDate").focus()
		return false;
	}
	if(trim(document.getElementById("expiryDate").value).length>0){
		if(!(isDate(trim(document.getElementById("expiryDate").value))))
		{
			document.getElementById("expiryDate").focus()
			return false;
		}
					
	}
	if(trim(document.getElementById("issuingAuthority").value).length==0){
		alert("Enter Issuing Authority")
		document.getElementById("issuingAuthority").focus()
		return false;
	}
	if(trim(document.getElementById("placeOfIssue").value).length==0){
		alert("Enter Place Of Issue")
		document.getElementById("placeOfIssue").focus()
		return false;
	}
	
	var checkPhone=isPhone(trim(document.getElementById("telephone").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("telephone").focus();

			return false;

		}
		
		var checkPhone=isPhone(trim(document.getElementById("mobile").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("mobile").focus();

			return false;

		}
		var checkEmail=isEmail(document.getElementById("email").value);

		if(checkEmail==false){
	
			alert(" Enter a valid email");
	
			document.getElementById("email").focus();
	
			return false;
	
		}
	
}
function validateFreeRegistrationFields(actId)
{
	
	if(trim(document.getElementById("title").value).length==0){
		alert("Enter Title")
		document.getElementById("title").focus()
		return false;
	}
	
	if(trim(document.getElementById("name").value).length==0){
		alert("Enter Name")
		document.getElementById("name").focus()
		return false;
	}
	if(trim(document.getElementById("address").value).length==0){
		alert("Enter Address")
		document.getElementById("address").focus()
		return false;
	}
	if(trim(document.getElementById("city").value).length==0){
		alert("Enter City")
		document.getElementById("city").focus()
		return false;
	}
	if(trim(document.getElementById("state").value).length==0){
		alert("Enter State")
		document.getElementById("state").focus()
		return false;
	}
	if(trim(document.getElementById("country").value).length==0){
		alert("Enter Country")
		document.getElementById("country").focus()
		return false;
	}
	if(trim(document.getElementById("pin").value).length==0){
		alert("Enter Pin")
		document.getElementById("pin").focus()
		return false;
	}
	if(trim(document.getElementById("mobileNumber").value).length==0){
		alert("Enter Mobile Number")
		document.getElementById("mobileNumber").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("mobileNumber").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("mobileNumber").focus();

			return false;

		}
	if(trim(document.getElementById("telephone").value).length==0){
		alert("Enter Telephone")
		document.getElementById("telephone").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("telephone").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("telephone").focus();

			return false;

		}
	
	if(trim(document.getElementById("email").value).length==0){
		alert("Enter Email")
		document.getElementById("email").focus()
		return false;
	}
	var checkEmail=isEmail(document.getElementById("email").value);

	if(checkEmail==false){

		alert(" Enter a Valid Email");

		document.getElementById("email").focus();

		return false;

	}
	var nationalitycnt=trim(document.getElementById("nationalitycnt").value);
	var nationalitycntflag=0;
	for(var i=1;i<=nationalitycnt;i++)
	{
		if(document.getElementById("nationality"+i).checked==true){
			nationalitycntflag=1;
		}
	}

	if(nationalitycntflag==0){
		alert("Enter Nationality")
		document.getElementById("action").focus()
		return false;
	}
}
function validateRegistrationFields(actId){
	if(trim(document.getElementById("title").value).length==0){
		alert("Enter Title")
		document.getElementById("title").focus()
		return false;
	}
	if(trim(document.getElementById("name").value).length==0){
		alert("Enter Name")
		document.getElementById("name").focus()
		return false;
	}
	if(trim(document.getElementById("organisation").value).length==0){
		alert("Enter Organisation")
		document.getElementById("organisation").focus()
		return false;
	}
	if(trim(document.getElementById("badgeName").value).length==0){
		alert("Enter Badge Name")
		document.getElementById("badgeName").focus()
		return false;
	}
	if(trim(document.getElementById("address").value).length==0){
		alert("Enter Address")
		document.getElementById("address").focus()
		return false;
	}
	if(trim(document.getElementById("city").value).length==0){
		alert("Enter City")
		document.getElementById("city").focus()
		return false;
	}
	if(trim(document.getElementById("state").value).length==0){
		alert("Enter State")
		document.getElementById("state").focus()
		return false;
	}
	if(trim(document.getElementById("country").value).length==0){
		alert("Enter Country")
		document.getElementById("country").focus()
		return false;
	}
	if(trim(document.getElementById("pin").value).length==0){
		alert("Enter Pin")
		document.getElementById("pin").focus()
		return false;
	}
	if(trim(document.getElementById("mobileNumber").value).length==0){
		alert("Enter Mobile Number")
		document.getElementById("mobileNumber").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("mobileNumber").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("mobileNumber").focus();

			return false;

		}
	if(trim(document.getElementById("telephone").value).length==0){
		alert("Enter Telephone")
		document.getElementById("telephone").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("telephone").value));

		if(checkPhone==false){

			alert("Enter a valid number");

			document.getElementById("telephone").focus();

			return false;

		}
	
	if(trim(document.getElementById("email").value).length==0){
		alert("Enter Email")
		document.getElementById("email").focus()
		return false;
	}
	var checkEmail=isEmail(document.getElementById("email").value);

	if(checkEmail==false){

		alert(" Enter a Valid Email");

		document.getElementById("email").focus();

		return false;

	}

	if(trim(document.getElementById("natureOfBusiness").value).length==0){
		alert("Enter Nature Of Business")
		document.getElementById("natureOfBusiness").focus()
		return false;
	}
	var nationalitycnt=trim(document.getElementById("nationalitycnt").value);
	var nationalitycntflag=0;
	for(var i=1;i<=nationalitycnt;i++)
	{
		if(document.getElementById("nationality"+i).checked==true){
			nationalitycntflag=1;
		}
	}

	if(nationalitycntflag==0){
		alert("Enter Nationality")
		document.getElementById("action").focus()
		return false;
	}
	
	var nationalitycnt=trim(document.getElementById("currencycnt").value);
	var nationalitycntflag=0;
	for(var i=1;i<=nationalitycnt;i++)
	{
		if(document.getElementById("currency"+i).checked==true){
			nationalitycntflag=1;
		}
	}

	if(nationalitycntflag==0){
		alert("Enter Currency")
		document.getElementById("action").focus()
		return false;
	}

	
	
	var tariffCategorycnt=trim(document.getElementById("tariffCategorycnt").value);
	var tariffCategorycntflag=0;
	for(var i=1;i<=tariffCategorycnt;i++)
	{
		if(document.getElementById("tariffCategoryId"+i).checked==true){
			tariffCategorycntflag=1;
		}
	}

	if(tariffCategorycntflag==0){
	
		alert("Enter Tariff Category")
		document.getElementById("action").focus()
		return false;
	}
	
	var numberOfDelegatescnt=trim(document.getElementById("numberOfDelegatescnt").value);
	var numberOfDelegatescntflag=0;
	for(var i=1;i<=numberOfDelegatescnt;i++)
	{
		if(document.getElementById("numberOfDelegates"+i).checked==true){
			numberOfDelegatescntflag=1;
		}
	}

	if(numberOfDelegatescntflag==0){
		alert("Enter Number Of Delegates")
		document.getElementById("action").focus()
		return false;
	}
	var paymentModecnt=trim(document.getElementById("paymentModecnt").value);
	var paymentModecntflag=0;
	var paymentId=0;
	for(var i=1;i<=paymentModecnt;i++)
	{
		if(document.getElementById("paymentModeId"+i).checked==true){
			paymentModecntflag=1;
			paymentId=document.getElementById("paymentModeId"+i).value;
		}
	}

	if(paymentModecntflag==0){
		alert("Enter Payment Mode")
		document.getElementById("action").focus()
		return false;
	}else{
		if(paymentId=="1")
		{
			  	var cardholdercnt=trim(document.getElementById("cardholdercnt").value);
				var cardholderflag=0;
				for(var i=1;i<=cardholdercnt;i++)
				{
					if(document.getElementById("cardholder"+i).checked==true){
						cardholderflag=1;
						
					}
				}
			
				if(cardholderflag==0){
					alert("Select whether you are the credit card holder or not")
					document.getElementById("action").focus()
					return false;
				}
				
			  if(document.getElementById("cardholder2").checked==true)
			  {
				if(trim(document.getElementById("cardCopy").value).length==0){
					alert("Enter credit card Copy")
					document.getElementById("cardCopy").focus()
					return false;
				}
				if(trim(document.getElementById("idProof").value).length==0){
					alert("Enter photo Id proof of credit card owner")
					document.getElementById("idProof").focus()
					return false;
				}
			}
		}
	}
	if(document.getElementById("terms").checked==false){
		alert("Please accept Terms and Conditions. ")
		document.getElementById("action").focus()
		return false;	
	}
}

function validateHomeCongressFields()
{
	var lengthofNew = document.getElementById("second").length;
	if(lengthofNew<3)
	{
		alert("Please select atleast three congress speakers");
		document.getElementById("second").focus();
		return false;
	}
	if(lengthofNew>3)
	{
		alert("You can select only three congress speakers");
		document.getElementById("second").focus();
		return false;
	}
}
function validateHomeCommitteFields()
{
	var lengthofNew = document.getElementById("second").length;
	if(lengthofNew<3)
	{
		alert("Please select atleast three scientific committee");
		document.getElementById("second").focus();
		return false;
	}
	if(lengthofNew>3)
	{
		alert("You can select only three scientific committee");
		document.getElementById("second").focus();
		return false;
	}
}
function popitup(url,width,height)
{
	var url=url;
	if(width>0 && height>0)
	{
	var width=width;

	var height=height;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'
	}else{
		winprops="";
	}
	newwindow=window.open(url,'Popup',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;
}
function addHomeSpeakers()
{
	var url="addHomeSpeakers.php";
	var width=650;

	var height=280;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'AddSpeakers',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function addHomeCommitte()
{
	var url="addHomeCommitte.php";
	var width=650;

	var height=280;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'AddSpeakers',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;
}
function editAim(id)
{
	var url="editAim.php?fid="+id
	var width=650;

	var height=350;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'EditIndex',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}

function editHomeScientist(id)
{
	var url="homeScientist.php?fid="+id
	var width=650;

	var height=450;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'EditIndex',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function replaceMe(width,height,type,folder,filename,divname)
{
	
	var url="replaceIndex.php?width="+width+"&height="+height+"&type="+type+"&folder="+folder+"&filename="+filename+"&divname="+divname
	var width=450;

	var height=230;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'EditIndex',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}


function getAmount()
{
	var scount=document.getElementById("scount").value;
	
	var iamount=0;
	var damount=0;
	for(i=1;i<=scount;i++)
	{
		if(document.getElementById("sponsorshipId["+i+"]").checked==true)
		{
			
			if(document.getElementById("currency1").checked==true)
			{
				damount=Number(document.getElementById("dlramount"+i).value)+damount;
			}else{
				iamount=Number(document.getElementById("inramount"+i).value)+iamount;
			}
						
		}
	}
	
	document.getElementById("dlrsumamount").value=damount;
	document.getElementById("inrsumamount").value=iamount;
	if(iamount>0)
	{
		iamount=Number(iamount+((iamount*12.5)/100));
		document.getElementById("totalAmount").value=iamount;
	}else{
		document.getElementById("totalAmount").value=damount;
	}
	
}
function validateTradeRegistrationFields(actId){
	
	var scount=document.getElementById("scount").value;
	var flag=0;
	
	if(trim(document.getElementById("companyName").value).length==0){
		alert("Enter Company Name")
		document.getElementById("companyName").focus()
		return false;
	}
	if(trim(document.getElementById("contactPerson").value).length==0){
		alert("Enter Contact Person")
		document.getElementById("contactPerson").focus()
		return false;
	}
	if(trim(document.getElementById("mailingAddress").value).length==0){
		alert("Enter Mailing Address")
		document.getElementById("mailingAddress").focus()
		return false;
	}
	if(trim(document.getElementById("phone").value).length==0){
		alert("Enter Phone")
		document.getElementById("phone").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("phone").value));
	if(checkPhone==false){
		alert("Enter a valid number");
		document.getElementById("phone").focus();
		return false;
	}
	if(trim(document.getElementById("mobile").value).length==0){
		alert("Enter Mobile")
		document.getElementById("mobile").focus()
		return false;
	}
	var checkPhone=isPhone(trim(document.getElementById("mobile").value));
	if(checkPhone==false){
		alert("Enter a valid number");
		document.getElementById("mobile").focus();
		return false;
	}
	if(trim(document.getElementById("email").value).length==0){
		alert("Enter Email")
		document.getElementById("email").focus()
		return false;
	}
	var checkEmail=isEmail(document.getElementById("email").value);
	if(checkEmail==false){
		alert(" Enter a Valid Email");
		document.getElementById("email").focus();
		return false;
	}

	for(i=1;i<=scount;i++)
	{
		if(document.getElementById("sponsorshipId["+i+"]").checked==true)
		{
			flag=1;
		}
	}
	if(flag==0)
	{
		alert("Select Category")
		document.getElementById("action").focus()
		return false;
	}
	var paymentModecnt=trim(document.getElementById("paymentModecnt").value);
	var paymentModecntflag=0;
	var paymentId=0;
	for(var i=1;i<=paymentModecnt;i++)
	{
		if(document.getElementById("paymentModeId"+i).checked==true){
			paymentModecntflag=1;
			paymentId=document.getElementById("paymentModeId"+i).value;
		}
	}

	if(paymentModecntflag==0){
		alert("Enter Payment Mode")
		document.getElementById("action").focus()
		return false;
	}else{
		if(paymentId=="1")
		{
			  	var cardholdercnt=trim(document.getElementById("cardholdercnt").value);
				var cardholderflag=0;
				for(var i=1;i<=cardholdercnt;i++)
				{
					if(document.getElementById("cardholder"+i).checked==true){
						cardholderflag=1;
						
					}
				}
			
				if(cardholderflag==0){
					alert("Select whether you are the credit card holder or not")
					document.getElementById("action").focus()
					return false;
				}
				
			  if(document.getElementById("cardholder2").checked==true)
			  {
				if(trim(document.getElementById("cardCopy").value).length==0){
					alert("Enter credit card Copy")
					document.getElementById("cardCopy").focus()
					return false;
				}
				if(trim(document.getElementById("idProof").value).length==0){
					alert("Enter photo Id proof of credit card owner")
					document.getElementById("idProof").focus()
					return false;
				}
			  }
			
		}
	}
	if(document.getElementById("terms").checked==false){
		alert("Please accept Terms and Conditions. ")
		document.getElementById("action").focus()
		return false;	
	}
}

function openMalConverter(cntrl)
{
	var url="convertToMal.php?cntrl="+cntrl

	var width=850;

	var height=450;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;
}

function openEditor(cntrl,name)
{
	var url="";
	if(document.getElementById(cntrl).value.length>0)
	{
		url="openEditor.php?cntrl="+cntrl+"&name="+name+"&def=exist";
	}else{
		url="openEditor.php?cntrl="+cntrl+"&name="+name;
	}
	var width=600;
	var height=330;
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'
	newwindow=window.open(url,'name',winprops);
	if (window.focus) {
		newwindow.focus()
	}
	return false;
}




function selectAllCriteria(cntrl)

{

	

	var ctlForm = cntrl.form;

	for (var i = 0; i < ctlForm.elements.length; i++)

	{

		var ctl = ctlForm.elements[i];

		if (ctl.id.indexOf("searchBy") == 0 && ctl.checked != cntrl.checked)

		{

			ctl.checked = cntrl.checked;

		}

						   

	}

}

function toggleCBs(ctlToggleAllCB) {

	var ctlForm = ctlToggleAllCB.form;

	var ctlTR = null;

	for (var i = 0; i < ctlForm.elements.length; i++)

	{

	  var ctl = ctlForm.elements[i];

	   if (ctl.id.indexOf("check") == 0 && ctl.checked != ctlToggleAllCB.checked) 

	   {

			
			if(ctl.alt.indexOf("noedit")==-1)
				ctl.checked = ctlToggleAllCB.checked;

			ctlTR = getTRFromCB(ctl);

			if (ctlTR)

				 changeAppearance(ctlTR, ctl.checked, 0, strToggleColor);

	    }

	}

}

function getTRFromCB(ctlCB) {

	var ctlTR = null;

	if (ctlCB.parentNode && ctlCB.parentNode.parentNode)

	 ctlTR = ctlCB.parentNode.parentNode;

	 else if (ctlCB.parentElement && ctlCB.parentElement.parentElement)

	  ctlTR = ctlCB.parentElement.parentElement;

	return ctlTR;

}



function rollTR(strID, nState) 

{

	var ctlCB = document.getElementById('check[' + strID+']');

	var ctlTR = document.getElementById('myRow' + strID);

	

	if ((!ctlCB || !ctlCB.checked) && ctlTR)

	 changeAppearance(ctlTR, false, nState, strRollColor);

}



function changeAppearance(ctlTR, bIsRowChecked, nState, strOnColor) {

	if (useHighlighting) {

		if (ctlTR && ctlTR.className == "firstrow")

		 ctlTR.style.backgroundColor = bIsRowChecked || (nState == 1) ? strOnColor : strRowOneColor;

		else if (ctlTR && ctlTR.className == "secrow")

		  ctlTR.style.backgroundColor = bIsRowChecked || (nState == 1) ? strOnColor : strRowTwoColor;

		

	}

}



function changeRowStyle(cntrl,id)

{

	if(document.getElementById(cntrl+"["+id+"]").checked==true)

	{

		if(document.getElementById("myRow"+id))

		{

			document.getElementById("myRow"+id).className='firstrowmovr';

		}

	}

	if(document.getElementById(cntrl+"["+id+"]").checked==false)

	{

		if(document.getElementById("myRow"+id))

		{

			if((id%2)==0)

				document.getElementById("myRow"+id).className='secrow';

			else

				document.getElementById("myRow"+id).className='firstrow';

		}

	}

}



function popupComment(id)

{

	var url="viewComment.php?id="+id

	var width=650;

	var height=500;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=1'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}



function uploadImage(cntrl,id,dir,table,tableid)

{

	var url="uploadImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}

function uploadOtherImage(cntrl,id,dir,table,tableid,itemcount)

{
	
	var dirname=dir;
	dir=dir;
	var url="uploadOtherImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid)+"&itemcount="+encodeURIComponent(itemcount)+"&dirname="+encodeURIComponent(dirname);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function uploadBlogImage(cntrl,id,dir,table,tableid,itemcount)

{

	dir="../../"+dir;
	var url="uploadPostImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid)+"&itemcount="+encodeURIComponent(itemcount);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function uploadNewsImage(cntrl,id,dir,table,tableid,itemcount)

{

	dir="../../"+dir;
	var url="uploadNewsImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid)+"&itemcount="+encodeURIComponent(itemcount);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function uploadFamilyImage(cntrl,id,dir,table,tableid,itemcount)

{

	dir="../../"+dir;
	var url="uploadFamilyImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid)+"&itemcount="+encodeURIComponent(itemcount);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}
function uploadAdvtImage(cntrl,id,dir,table,tableid,itemcount)

{

	dir="../../"+dir;
	var url="uploadadvtImage.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid)+"&itemcount="+encodeURIComponent(itemcount);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}

function editUploadedImage(cntrl,name,dir)

{

	var url="editImage.php?cntrl="+cntrl+"&name="+name+"&dir="+encodeURIComponent(dir);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}

function uploadFreebies(cntrl,id,dir,table,tableid)

{

	var url="uploadFreebies.php?cntrl="+cntrl+"&id="+id+"&dir="+encodeURIComponent(dir)+"&table="+encodeURIComponent(table)+"&tableid="+encodeURIComponent(tableid);

	var width=450;

	var height=200;

	var winl = (screen.width - width) / 2;

	var wint = (screen.height - height) / 2;

	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',menubar=0,toolbar=0,scrollbars=0,status=0,resizable=0'

	newwindow=window.open(url,'name',winprops);

	if (window.focus) {

		newwindow.focus()

	}

	return false;

}

function changeImage(newImage,cntrl,imgurl)

{

	action="changeImage";

	var imgurl=imgurl+newImage;

	opener.document.getElementById("editedImage").innerHTML="<img src=\""+imgurl+"\" width=\"70\" height=\"70\"  border=\"0\">";

	opener.document.getElementById(cntrl).value = newImage;

}
function showImage(src)

{

	

	newwindow=window.open("popup.html?"+src, "ImageViewer", "resizable=1,scrollbars=1,HEIGHT=200,WIDTH=200");

	newwindow.document.title="Image Preview";

	if (window.focus) {newwindow.focus()}

		return false;

}



function changefilename(str,cntrl)

{  

	opener.document.getElementById(cntrl).value = str;

}




