// JS functions for Tritax offices
function showBedfordOffice() {

    document.getElementById("bedfordOffice").style.display = 'block';
    document.getElementById('londonOffice').style.display = 'none';
    document.getElementById('haywardsHeathOffice').style.display = 'none';

}

function showLondonOffice() {

    document.getElementById('londonOffice').style.display = 'block';
    document.getElementById("bedfordOffice").style.display = 'none';
    document.getElementById('haywardsHeathOffice').style.display = 'none';

}

function showHaywardsHeathOffice() {

    document.getElementById('haywardsHeathOffice').style.display = 'block';
    document.getElementById("bedfordOffice").style.display = 'none';
    document.getElementById('londonOffice').style.display = 'none';

}

// JS Functions for Directors section
function showDirectors() {

    document.getElementById('d').style.display = 'block';
    document.getElementById('d1').style.display = 'none';
    document.getElementById('d2').style.display = 'none';
    document.getElementById('d3').style.display = 'none';
    document.getElementById('d4').style.display = 'none';

}

function showDirector1() {

    //document.getElementById('d').style.display = 'none';
    document.getElementById('d1').style.display = 'block';
    document.getElementById('d2').style.display = 'none';
    document.getElementById('d3').style.display = 'none';
    document.getElementById('d4').style.display = 'none';

}

function showDirector2() {

    //document.getElementById('d').style.display = 'none';
    document.getElementById('d1').style.display = 'none';
    document.getElementById('d2').style.display = 'block';
    document.getElementById('d3').style.display = 'none';
    document.getElementById('d4').style.display = 'none';

}

function showDirector3() {

    //document.getElementById('d').style.display = 'none';
    document.getElementById('d1').style.display = 'none';
    document.getElementById('d2').style.display = 'none';
    document.getElementById('d3').style.display = 'block';
    document.getElementById('d4').style.display = 'none';

}

function showDirector4() {

   // document.getElementById('d').style.display = 'none';
    document.getElementById('d1').style.display = 'none';
    document.getElementById('d2').style.display = 'none';
    document.getElementById('d3').style.display = 'none';
    document.getElementById('d4').style.display = 'block';

}

function AdminLogin()
{
	var login = document.frmlogin.txtLogin.value;
	var pass  = document.frmlogin.txtPassword.value;
	if(login=='')
	{
		alert("Please enter user name.");
		document.frmlogin.txtLogin.focus();
		return false;
	}
	if(pass=='')
	{
		alert("Please enter password.");
		document.frmlogin.txtPassword.focus();
		return false;
	}
	return true;
}

function UserLogin()
{
   //return true;
   //alert("login test");
   //alert(document.getElementById("txtUserName").value);
   //return false;

	var login = document.frmlogin.txtUserName.value;
	var pass  = document.frmlogin.txtPassword.value;
	if(login=='')
	{
		alert("Please enter user name.");
		document.frmlogin.txtUserName.focus();
		return false;
	}
	if(pass=='')
	{
		alert("Please enter password.");
		document.frmlogin.txtPassword.focus();
		return false;
	}
	return true;
}

function YourUserLogin()
{
	var login = document.frmyourlogin.txtUserName.value;
	var pass  = document.frmyourlogin.txtPassword.value;
	if(login=='')
	{
		alert("Please enter user name.");
		document.frmyourlogin.txtUserName.focus();
		return false;
	}
	if(pass=='')
	{
		alert("Please enter password.");
		document.frmyourlogin.txtPassword.focus();
		return false;
	}
	return true;
}
function showImage(imgId)
{
	var NumberOfLagreImages = document.largeImage.length;

	for(var counter =0; counter < NumberOfLagreImages; counter++)
	{
		document.largeImage[counter].style.display = 'none';
	}

	if(imgId != '')
	{
		var objImage = document.getElementById(imgId);
	}
	else
	{
		var objImage = document.getElementById('img1');
	}

	objImage.style.display = 'inline';

}

function isCharsInBag (s, bag)
{
    var i;
    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return(false);
    }
    return true;
}

function isValidChar(testingStr, userStr)
{
	var condition = true;

	for(counter=0; counter < testingStr.length; counter++)
	{
		if(testingStr.indexOf(userStr.charAt(counter)) == -1)
		{
			condition = false;
		}
	}

	return condition;
}
/*
function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2)
		  {
		  alert(alerttxt);
		  return false
		  }
		else {
		return true
		}
	}
}


function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false}
}
}

*/

function EmailCheck(email){

		if(email.value==''){
			alert("Please Enter Email Address");
            email.focus();
            return false;
		}
		if ( !this.isCharsInBag( email.value, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._@-" ))
		{

            alert("Invalid Email Address");
            email.focus();
            return false;
		}

	if(email.value != '')
	   {
		var str=email.value;
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		var sdot=str.indexOf(dot,ldot+1);

		if (str.indexOf(at)==-1){
			alert("Invalid Email Address");
            email.focus();
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			alert("Invalid Email Address");
            email.focus();
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }
		if (str.substring(ldot+1)==''){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }
		 if (str.substring(sdot+1)==''){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }
		 if (str.indexOf(" ")!=-1){
			alert("Invalid Email Address");
            email.focus();
		    return false;
		 }
		 if(str.lastIndexOf(".") == str.length-1)
		 {
		 	alert("Invalid Email Address");
            email.focus();
		    return false;
		 }
	}//end of else
	return true;
}


function ContactUsValidation()
{
   	var title = document.frmcontactus.txttitle;
	var name = document.frmcontactus.txtname;
	var surname = document.frmcontactus.txtsurname;
	var address = document.frmcontactus.txtaddress;
	var county = document.frmcontactus.txtcounty;
	var town = document.frmcontactus.txttown;
	var postcode = document.frmcontactus.txtpostcode;
	var email = document.frmcontactus.txtemail;
	var dayphone = document.frmcontactus.txtdayphone;
	//var evephone = document.frmcontactus.txtevephone;
	//var mobile = document.frmcontactus.txtmobile;
	var pricerange = document.frmcontactus.cmbpricerange;
	var numofbedrooms = document.frmcontactus.txtnofbedrooms;
	var findus = document.frmcontactus.cmbfindus;
	var pleasestate = document.frmcontactus.txtpleasestate;

	if (name.value == "")
	{
		alert("Please Fill the 'Name' field");
		name.focus();
		return false;
	}


	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
	{
		alert("Name fields only allow alphabet characters");
		name.select();
		return false;
	}

	if (surname.value == "")
	{
		alert("Please Fill the 'Surname' field");
		surname.focus();
		return false;
	}


	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
	{
		alert("Name fields only allow alphabet characters");
		surname.select();
		return false;
	}

	if (address.value == "")
	{
		alert("Please Fill the 'Address' field");
		address.focus();
		return false;
	}

	if (county.value == "")
	{
		alert("Please Fill the 'County' field");
		county.focus();
		return false;
	}

	if (postcode.value == "")
	{
		alert("Please Fill the 'Postcode' field");
		postcode.focus();
		return false;
	}

	if(!this.EmailCheck(email))
	{
		return  false;
	}

	if (dayphone.value == "")
	{
		alert("Please Fill the 'Land telephone' field");
		dayphone.focus();
		return false;
	}

//	if (evephone.value == "")
//	{
//		alert("Please Fill the 'Evening telephone' field");
//		evephone.focus();
//		return false;
//	}

//	if (mobile.value == "")
//	{
//		alert("Please Fill the 'Mobile telephone' field");
//		mobile.focus();
//		return false;
//	}
//
	if (pricerange.value == "")
	{
		alert("Please Fill the 'Price range' field");
		pricerange.focus();
		return false;
	}

	if (numofbedrooms.value == "")
	{
		alert("Please Fill the 'Number of bedrooms' field");
		numofbedrooms.focus();
		return false;
	}

	if (findus.value == "")
	{
		alert("Please Fill the 'How did you find us?' field");
		findus.focus();
		return false;
	}
	if (pleasestate.value == "")
	{
		alert("Please Fill the 'How did you find us? - Please State' field");
		pleasestate.focus();
		return false;
	}
	return true;
}

function RegisterValidation2()
{
	var name = document.frmcontactus.txtname;
	var address = document.frmcontactus.txtaddress;
	var county = document.frmcontactus.txtcounty;
	var postcode = document.frmcontactus.txtpostcode;
	var email = document.frmcontactus.txtemail;
	var dayphone = document.frmcontactus.txtdayphone;
	//var evephone = document.frmcontactus.txtevephone;
	var mobile = document.frmcontactus.txtmobile;
	//var numofbedrooms = document.frmcontactus.txtnofbedrooms;

	if (name.value == "")
	{
		alert("Please Fill the 'Name' field");
		name.focus();
		return false;
	}


	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
	{
		alert("Name fields only allow alphabet characters");
		name.select();
		return false;
	}

	if (address.value == "")
	{
		alert("Please Fill the 'Address' field");
		address.focus();
		return false;
	}

	if (county.value == "")
	{
		alert("Please Fill the 'County' field");
		county.focus();
		return false;
	}

	if (postcode.value == "")
	{
		alert("Please Fill the 'Postcode' field");
		postcode.focus();
		return false;
	}

	if(!this.EmailCheck(email))
	{
		return  false;
	}



	if (dayphone.value == "")
	{
		alert("Please Fill the 'Daytime telephone' field");
		dayphone.focus();
		return false;
	}

	if (evephone.value == "")
	{
		alert("Please Fill the 'Evening telephone' field");
		evephone.focus();
		return false;
	}

	if (mobile.value == "")
	{
		alert("Please Fill the 'Mobile telephone' field");
		mobile.focus();
		return false;
	}

	if (numofbedrooms.value == "")
	{
		alert("Please Fill the 'Number of bedrooms' field");
		numofbedrooms.focus();
		return false;
	}

	if (!isValidChar("0123456789", numofbedrooms.value))
	{
		alert("Invalid Characters");
		numofbedrooms.select();
		return false;
	}

	return true;

}

function YourdetailsValidation()
{
	var name = document.frmyourdetails.txtname;
	var address = document.frmyourdetails.txtaddress;
	var telephone = document.frmyourdetails.txttelephone;	
	var email = document.frmyourdetails.txtemail;
	var web = document.frmyourdetails.txtweb;
	//var fsanumber = document.frmyourdetails.txtfsanumber;
	var chkTerms = document.frmyourdetails.chkTerms;
	
	if (name.value == "")
	{
		alert("Please Fill the 'Name' field");
		name.focus();
		return false;
	}
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
	{
		alert("Name fields only allow alphabet characters");
		name.select();
		return false;
	}
	if (address.value == "")
	{
		alert("Please Fill the 'Address' field");
		address.focus();
		return false;
	}
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/\\~`!@#$%^&*()_-+=|,<>.:;? ", address.value))
	{
		alert("Address fields contain invalid characters");
		address.select();
		return false;
	}
	if (telephone.value == "")
	{
		alert("Please Fill the 'Telephone' field");
		telephone.focus();
		return false;
	}
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()", telephone.value))
	{
		alert("Telephone fields contain invalid characters");
		telephone.select();
		return false;
	}	
	if(!this.EmailCheck(email))
	{
		return false ;
	}
	/*if (web.value == "")
	{
		alert("Please Fill the 'Web' field");
		web.focus();
		return false;
	}
	*/
	if (web.value != "")
		if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/\\~`!@#$%^&*()_-+=|,<>.:;? ", web.value))
		{
			alert("Web fields contain invalid characters");
			web.select();
			return false;
		}	
		
	if(!chkTerms.checked)
	{
		alert("You must accept 'Tritax Terms and Conditions'.");
		return false;
	}
	return true;
}

var kwRegSub=0;
// my address finder code start here
function pcaFastAddressBegin(postcode, building, language, style, account_code, license_code, machine_id, options)
{
   var scriptTag = document.getElementById("pcaScriptTag");
   var headTag = document.getElementsByTagName("head").item(0);
   var strUrl = "";
   //Build the url
//	fetch
   strUrl = "http://services.postcodeanywhere.co.uk/inline.aspx?";
   strUrl += "&action=fetch";
   strUrl += "&postcode=" + escape(postcode);
   strUrl += "&building=" + escape(building);
   strUrl += "&language=" + escape(language);
   strUrl += "&style=" + escape(style);
   strUrl += "&account_code=" + escape(account_code);
   strUrl += "&license_code=" + escape(license_code);
   strUrl += "&machine_id=" + escape(machine_id);
   strUrl += "&options=" + escape(options);
   strUrl += "&callback=pcaFastAddressEnd";

   //Make the request
   if (scriptTag)
   {
      headTag.removeChild(scriptTag);
   }
   scriptTag = document.createElement("script");
   scriptTag.src = strUrl
   scriptTag.type = "text/javascript";
   scriptTag.id = "pcaScript";
   headTag.appendChild(scriptTag);

//   setTimeout("if(kwRegSub==0){pcaFastAddressEnd();}", 5000);
}

function UpdateProfileValidation()
{
	var surname = document.frmupdateprofile.txtsurname;
	var firstname = document.frmupdateprofile.txtfirstname;
	var lastname = document.frmupdateprofile.txtlastname;
	var username = document.frmupdateprofile.txtuser;
	var oldpass = document.frmupdateprofile.txtoldpassword;
	var newpass = document.frmupdateprofile.txtnewpassword;
	var confpass = document.frmupdateprofile.txtconfpassword;



	if (surname.value=="")
	{
		alert("Please enter 'Sur Name'.");
		surname.select();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
	{
		alert("Name fields only allow alphabet characters");
		surname.select();
		return false;
	}

	if (firstname.value=="")
	{
		alert("Please enter 'First Name'.");
		firstname.select();
		return false;
	}
	else if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", firstname.value))
	{
		alert("Name fields only allow alphabet characters");
		firstname.select();
		return false;
	}

	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", lastname.value))
	{
		alert("Name fields only allow alphabet characters");
		lastname.select();
		return false;
	}
	if (username.value=="")
	{
		alert("Please enter 'User Name'.");
		username.select();
		return false;
	}
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", username.value))
	{
		alert("Please neter correct username.");
		username.select();
		return false;
	}
	if(oldpass.value != "" )
	{

		if (!isValidChar("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", newpass.value))
		{
			alert("You entered an invalid character");
			newpass.select();
			return false;
		}

		if (!isValidChar("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", confpass.value))
		{
			alert("You entered an invalid character");
			confpass.select();
			return false;
		}

		if(newpass.value != confpass.value)
		{
			alert('Your new password and confirm password fields do not match.');
			newpass.select();
			return false;
		}

	}

	return true;
}

function Forgotpassword()
{
	var email = document.frmforgotpassword.txtforgotemail;

	if(!this.EmailCheck(email))
	{
		return false ;
	}

	return true;

}
function YourForgotpassword()
{
	var email = document.frmyourforgotpassword.txtforgotemail;

	if(!this.EmailCheck(email))
	{
		return false ;
	}

	return true;

}


function ReferToFriend()
{
	var email = document.frmrefertofriend.txtemail;

	if(!this.EmailCheck(email))
	{
		return false ;
	}

	return true;

}

function divShowhide(chkDiv)
{
	//alert("abc");

	objDiv = document.getElementById(chkDiv);

		if (objDiv.style.display == 'none')
		{
			objDiv.style.display = 'inline';
		}

		else if (objDiv.style.display == 'inline')
		{
			objDiv.style.display = 'none';
		}
}
function pcaFastAddressEnd()
{kwRegSub=1;
   //Test for an error
   if (pcaIsError)
      {
         //Show the error message
         //alert(pcaErrorMessage);
		 //return false;
      }
   else
      {
         //Check if there were any items found
         if (pcaRecordCount==0)
            {
             //  alert("Sorry, no matching items found");
			 //  return false;
            }
         else
            {
			   document.getElementById("company").value	=	pca_organisation_name[0];
               document.getElementById("line1").value	=	pca_line1[0];
               document.getElementById("line2").value	=	pca_line2[0];
               document.getElementById("line3").value	=	pca_line3[0];
               document.getElementById("town").value		=	pca_post_town[0];
               document.getElementById("county").value	=	pca_county[0];
               document.getElementById("postcode").value	= 	pca_postcode[0];
			//id,seq,organisation_name,department_name,line1,line2,line3,line4,line5,post_town,county,postcode,mailsort,barcode,is_residential,is_small_organisation,is_large_organisation,admin_county,traditional_county,postal_county,delivery_point_suffix,checksum,name_or_number,sub_building_name,building_name,building_number,thoroughfare_name,thoroughfare_descriptor,dependent_thoroughfare_name,dependent_thoroughfare_descriptor,double_dependent_locality,dependent_locality,po_box_number,number_of_households,concatenation_operator,building_name_or_number,building_flat,reformatted_sub_building,reformatted_building_number,reformatted_building_name

            }
      }
var name = document.frmyourdetails.txtname;
var surname = document.frmyourdetails.txtsurname;
var email = document.frmyourdetails.txtemail;
var postcode = document.frmyourdetails.postcode;
var building = document.frmyourdetails.building;


if (name.value == "")
{
	alert("Please Fill the 'Name' field");
	name.focus();
	return false;
}


if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
{
	alert("Name fields only allow alphabet characters");
	name.select();
	return false;
}

if (surname.value == "")
{
	alert("Please Fill the 'Surname' field");
	surname.focus();
	return false;
}


if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
{
	alert("Name fields only allow alphabet characters");
	surname.select();
	return false;
}


if(!this.EmailCheck(email))
{
	return false ;
}

if (postcode.value == "")
{
	alert("Please Fill the 'Postcode' field");
	postcode.focus();
	return false;
}

if (building.value == "")
{
	alert("Please Fill the 'Building/Door' field");
	building.focus();
	return false;
}

document.frmyourdetails.submit();

}
function tritax_ann()
{
	document.getElementById('tabs').src = "site_images/tritax_announcements.gif";
	document.getElementById('tritax_announcements').style.display = 'inline';
	document.getElementById('my_announcements').style.display = 'none'
}
function my_ann()
{
	document.getElementById('tabs').src = "site_images/my_announcements.gif";
	document.getElementById('my_announcements').style.display = 'inline'
	document.getElementById('tritax_announcements').style.display = 'none';
}
function tritax_propertyreports()
{
	document.getElementById('tabs').src = "site_images/tritax_propertyreports.gif";
	document.getElementById('tritax_announcements').style.display = 'inline';
	document.getElementById('my_announcements').style.display = 'none'
}
function my_propertyreports()
{
	document.getElementById('tabs').src = "site_images/my_propertyreports.gif";
	document.getElementById('my_announcements').style.display = 'inline'
	document.getElementById('tritax_announcements').style.display = 'none';
}
var hWnd
function OpenNewWindow( passurl , width, height, left, top)
{
	//var x = screen.availWidth/2-200;
//	var x = (screen.availWidth-width);
//	var y = 150;

	var x = left;
	var y = top;

	enterCalled = true
	window.name = "parent"
	var url = passurl
	if( !hWnd )
	{
		//if no help window is open then open a new help window and give it focus
		hWnd = window.open(url,"popup","width=" + width + ",height=" + height +", left=" + x + ", top=" + y + ", resizable=yes,scrollbars=yes")
		hWnd.focus()
	}
	else if ( hWnd.closed )
	{
		//if no help window is open then open a new help window and give it focus
		hWnd = window.open(url,"popup","width=" + width + ",height=" + height +", left=" + x + ", top=" + y + ", resizable=yes,scrollbars=yes")
		hWnd.focus()
	}
	else
	{
		//if the help window is already open then update it and give it focus
		hWnd.location=url
		hWnd.focus()
	}
	// handle Navigator 2, which doesn't have an opener property
	if (!hWnd.opener) { hWnd.opener = window}
}
// my address finder code end  here
var trids;
function divShowhideAnn_old(chkDiv, code, curid, col1, col2)
{
	var array_trids = trids.split(",");
	for(r=1;r<array_trids.length;r++)
	{
		//var HideTr = document.getElementById(code+"_tr["+array_trids[r]+"]");
		//if (HideTr.style.display == 'inline')
		//{
		//	HideTr.style.display = 'none';
			this.SelectedAnnClass(code+"_td1_"+array_trids[r], code+"_td2_"+array_trids[r], col1);
		//}
	}
	var objDiv = document.getElementById(code+"_tr["+curid+"]");	
	//objDiv.style.display = 'inline';
	this.SelectedAnnClass(code+"_td1_"+curid, code+"_td2_"+curid, col2);
}
function divShowhideAnn(chkDiv, code, curid, col1, col2)
{
	var array_trids = trids.split(",");
	for(r=1;r<array_trids.length;r++)
	{
		//alert(code+"_td1_"+array_trids[r]+", "+ code+"_td2_"+array_trids[r]+", "+ col1);
		this.SelectedAnnClass(code+"_td1_"+array_trids[r], code+"_td2_"+array_trids[r], col1);
	}
	var objDiv = document.getElementById(code+"_tr["+curid+"]");	
	this.SelectedAnnClass(code+"_td1_"+curid, code+"_td2_"+curid, col2);
}

function SelectedAnnClass(td1, td2, col)
{
	objtd1 = document.getElementById(td1);
	objtd2 = document.getElementById(td2);
	objtd1.style.backgroundColor=col;
	objtd2.style.backgroundColor=col;
}