// JavaScript Document
function validateLogin ()
{	
	if ('' == trim($('txtUserName').value ) )	
	{
		$('adminError').style.display = 'block';
		$('adminError').innerHTML = 'Please Enter Your User Name';
		$('txtUserName').focus();
		return false;
	}
	else if (!isValidUserName(trim($('txtUserName').value )))
	{
		$('adminError').style.display = 'block';
		$('adminError').innerHTML = 'Please Enter a Valid User Name';
		$('txtUserName').focus();
		return false;
	}
	else if ('' == trim($('txtPassWord').value)	)
	{
		$('adminError').style.display	 = 'block';
		$('adminError').innerHTML 		 = 'Please Enter Your Password';
		$('txtPassWord').focus();
		return false;
	}
	else 
	{
		thisForm.txtWhat2Do.value = 'ADMIN_LOGIN';	
		thisForm.submit();
	}
}

/**
	###############################News Page Javascript Starts Here ###############################
*/
function SelectNews(newsId)
{
	$('hidNewsId').value 		= newsId;
	thisForm.txtWhat2Do.value 	= 'SHOW_NEWS';
	thisForm.submit();
}
function AddNews()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_NEWS';	
	thisForm.submit();
}
function __SaveNews(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text for news ");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date of news ");
		$('txtDate').focus();
		return false;
	}
	else
	{
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	}
}
function DeleteNews()
{
	if ($('hidNewsId').value  == '')
	{	
		alert("Please Select a News");
		return false;
	}
	else if (confirm("Do you really want to delete this news"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_NEWS';	
		thisForm.submit();		
	}
}
function EditNews ()
{
	if ($('hidNewsId').value  == '')
	{	
		alert("Please Select a News");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_NEWS';	
	thisForm.submit();
}
/**
	###############################News Page Javascript Ends Here ###############################
*/
/**
	###############################Site Page Javascript Ends Here ###############################
*/
function SelectSitePage (newsId)
{
	$('hidPageId').value 		= newsId;
	thisForm.txtWhat2Do.value 	= 'SHOW_SITEPAGE';
	thisForm.submit();
}
function EditSitePage ()
{
	if ($('hidPageId').value  == '')
	{	
		alert("Please Select a SitePage");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_SITEPAGE';	
	thisForm.submit();
}
function updateSitePageDetails (id)
{
	thisForm.txtWhat2Do.value = 'UPDATE_SITEPAGE';	
	thisForm.submit();	
}
function __fncLinksCount(){
	var	params = "cnt=" + encodeURI($('cmbNoLinks').value);
	$("cntlinks").value=$('cmbNoLinks').value;
	new Ajax.Request('updateprd.php?action=smartycamlink',{method:"get",parameters:params,onSuccess:smartycamlinksuccss,onFailure:dispErrorsmty})
}
function smartycamlinksuccss(reqObj){
	document.getElementById('linkscontendiv').style.display='block';
	document.getElementById('linkscontendiv').innerHTML = reqObj.responseText;
}
function dispErrorsmty(){
	
}
function __fncDeleteLinkPagetext(i,id){
	var	params = "id=" + encodeURI(id)+"&cnt=" + encodeURI($('cmbNoLinks').value);
	new Ajax.Request('updateprd.php?action=smartycamlinkdelete',{method:"get",parameters:params,onSuccess:smartycamlinkdelsuccss,onFailure:dispErrorsmtydel})
}
function smartycamlinkdelsuccss(reqObj){
	document.getElementById('linkscontendiv').style.display='block';
	document.getElementById('linkscontendiv').innerHTML = reqObj.responseText;
	$('cmbNoLinks').value=parseInt(parseInt($('cmbNoLinks').value)-parseInt(1));
}
function dispErrorsmtydel(){
	
}
function __fncEditLinkPagetext(id){
	thisForm.txtWhat2Do.value = 'EDIT_SITEPAGE';
	$("txthissitid").value=id;
	thisForm.submit();
}
function updateSiteSmartyPageDetails(id){
	thisForm.txtWhat2Do.value = 'UPDATE_SITEPAGE';
	$("txthissitid").value=id;
	thisForm.submit();
}
/**
	###############################Site Page Javascript Ends Here ###############################
*/
	
/*
	###############################Javascript for chage pass word starts here ##########################
*/
function __fncChangePassword ()
{
	if (trim($('username').value) == '')
	{
		alert("Please Enter a User Name");
		$('username').focus();
		return false;
	}
	else if (!isValidUserName (trim($('username').value)) )
	{
		alert("Special Characters  Are Not Allowed.");
		$('username').focus();
		return false;
	}
	else if (trim($('txtOldPassword').value) == '')
	{
		alert("Please Enter Your Current Password");
		$('txtOldPassword').focus();
		return false;
	}
	else if (trim($('txtNewPassword').value) == '')
	{
		alert("Please Enter New Password");
		$('txtNewPassword').focus();
		return false;
	}
	else if (trim($('txtNewPassword').value).length < 6)
	{
		alert("Password Chosen Must be Minimum 6 Characters Long.	");
		$('txtNewPassword').focus();
		return false;
	}
	else if (trim($('txtConfirmPassword').value) == '')
	{
		alert("Please Enter  Confirm Password");
		$('txtConfirmPassword').focus();
		return false;
	}
	else if (trim($('txtConfirmPassword').value) != trim($('txtNewPassword').value))
	{
		alert("Password Mismatch Please Verify NewPassword and ConfirmPassword ");
		$('txtConfirmPassword').select();
		return false;
	}
	else
	{
		thisForm.txtWhat2Do.value = 'CHANGE_PASSWORD';	
		thisForm.submit();
	}
}
function __fncClearfields()
{
	$('txtNewPassword').value = '';	
	$('txtConfirmPassword').value = '';	
	$('txtOldPassword').value = '';	
	$('username').value = '';	
}
/**
	#################################### Javascript for chage pass word Ends here ##########################
*/
////Trim Functions
//	function ltrim(str) {
//		for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
//		return str.substring(k, str.length);
//	}
//	function rtrim(str) {
//		for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
//		return str.substring(0,j+1);
//	}
//	function trim(str) {
//		return ltrim(rtrim(str));
//	}
//	
//	function isValidUserName(val){
//		if (val.match(/^[a-zA-Z0-9_]+$/)){
//			if(val.match(/^[_]+$/)){
//				return false;
//			}else{
//				return true;
//			}
//		}else{
//			return false;
//		}
//	}
//	function isWhitespace(charToCheck) {
//		var whitespaceChars = " \t\n\r\f";
//		return (whitespaceChars.indexOf(charToCheck) != -1);
//	}
//	
	
/*########################################## Client Side Validation of Contact Us page Starts Here   #################################################*/
function SendContactDetails ()
{	//alert($("selected_option").innerHTML);
	if('' == trim($("txtCompany").value))
	{
		$('err_txtCompany').style.visibility = 'visible';
		$('txtCompany').style.border	  = '1px solid #FF0000';
		$('err_txtCompany').innerHTML  	  = '* Required field.';
		$('txtCompany').focus();
		return false;	
	}
	else if('' == trim($("txtContactName").value))
	{
		$('err_txtContactName').style.visibility = 'visible';
		$('txtContactName').style.border	  = '1px solid #FF0000';
		$('err_txtContactName').innerHTML  	  = '* Required field.';
		$('txtContactName').focus();
		return false;	
	}
	else if('' == trim($("txtContactEmail").value))
	{
		$('err_txtContactEmail').style.visibility = 'visible';
		$('txtContactEmail').style.border	  = '1px solid #FF0000';
		$('err_txtContactEmail').innerHTML  	  = '* Required field.';
		$('txtContactEmail').focus();
		return false;	
	}
	else if (! /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trim($('txtContactEmail').value)))
	{
		$('err_txtContactEmail').style.visibility = 'visible';
		$('txtContactEmail').style.border	  = '1px solid #FF0000';
		$('err_txtContactEmail').innerHTML  	  = 'Invalid Email.';
		$('txtContactEmail').focus();
		return false;	
	}
	else if('' == trim($("txtAddress").value))
	{
		$('err_txtAddress').style.visibility = 'visible';
		$('txtAddress').style.border	  = '1px solid #FF0000';
		$('err_txtAddress').innerHTML  	  = '* Required field.';
		$('txtAddress').focus();
		return false;	
	}
	else if('Select Interest' == trim($("selected_option").innerHTML))
	{
		$('err_selected_option').style.visibility = 'visible';
		$('selected_option').style.border	  = '1px solid #FF0000';
		$('err_selected_option').innerHTML  	  = '* Required field.';
		$('selected_option').focus();
		return false;	
	}
	
	else if('' == trim($("txtContactTelephone").value))
	{
		$('err_txtContactTelephone').style.visibility = 'visible';
		$('txtContactTelephone').style.border	  = '1px solid #FF0000';
		$('err_txtContactTelephone').innerHTML  	  = '* Required field.';
		$('txtContactTelephone').focus();
		return false;	
	}
	else
	{	
		thisForm.txtWhat2Do.value = "SEND_CONTACT_DETAILS";	
		thisForm.submit ();	
	}
}
function removeError(thisvariable)
{
	thisvariable.style.border = "none";	
	$('err_'+thisvariable.id).style.visibility = 'hidden';
}
function removeErrorinterest(thisvariable)
{
	$(thisvariable).style.border = "none";	
	$('err_'+thisvariable).style.visibility = 'hidden';
}
/*########################################## Client Side Validation of Contact Us page Ends Here   #################################################*/


////////////////////////////////////////////////////////////////////  Corporate JAvascript  Starts Here ///////////////////////////////////////////////
function DeleteCorporateEnquiry ()
{
	thisForm.txtWhat2Do.value = 'DELETE_CORPORATE'; 
	thisForm.submit();
}
function SelectCorporate (CorporateId)
{
	$("hidCorporateId").value = CorporateId;
	thisForm.txtWhat2Do.value = 'SHOW_CORPORATE'; 
	thisForm.submit();
}
/**
	###############################GiftVouchure Page Javascript Ends Here ###############################
*/
function SelectGiftVouchure (GvId)
{
	$('hidVouchureId').value 		= GvId;
	thisForm.txtWhat2Do.value 	= 'SHOW_GVPAGE';
	thisForm.submit();
}
function EditGV ()
{
	if ($('hidVouchureId').value  == '')
	{	
		alert("Please Select a GiftVouchure ");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_GV';	
	thisForm.submit();
}
function addtGV ()
{
	thisForm.txtWhat2Do.value = 'ADD_GV';	
	thisForm.submit();
}
function updateGVDetails (id)
{
	$('errGiftNumber').style.display = 'none';
	$('errGifttitle').style.display = 'none';
	$('errDescription').style.display = 'none';
	$('errRate').style.display = 'none';
	$('errImage').style.display = 'none';
	if ('' == trim($('txtGiftNumber').value ) )	
	{
		$('errGiftNumber').style.display = 'block';
		$('errGiftNumber').innerHTML = 'Enter Gift Number';
		$('txtGiftNumber').focus();
		return false;
	}
	if (isNaN(trim($('txtGiftNumber').value )) )	
	{
		$('errGiftNumber').style.display = 'block';
		$('errGiftNumber').innerHTML = 'Gift Number should be bumbers only';
		$('txtGiftNumber').focus();
		return false;
	}
	if ('' == trim($('txtGifttitle').value ) )	
	{
		$('errGifttitle').style.display = 'block';
		$('errGifttitle').innerHTML = 'Enter Gift title';
		$('txtGifttitle').focus();
		return false;
	}
	if ('' == tinyMCE.get('txtDescription').getContent() )
	{
		$('errDescription').style.display = 'block';
		$('errDescription').innerHTML = 'Enter Description';
		$('txtDescription').focus();
		return false;
	}
	if ('' == trim($('txtRate').value ) )	
	{
		$('errRate').style.display = 'block';
		$('errRate').innerHTML = 'Enter Gift Rate';
		$('txtRate').focus();
		return false;
	}
	if (isNaN(trim($('txtRate').value )) )	
	{
		$('errRate').style.display = 'block';
		$('errRate').innerHTML = 'Gift Rate should be numbers only';
		$('txtRate').focus();
		return false;
	}
	if(id==''){
		if ('' == trim($('fileImage').value ) )	
	{
		$('errImage').style.display = 'block';
		$('errImage').innerHTML = 'Upload Image';
		$('fileImage').focus();
		return false;
	}
	}
	if(id==''){
		thisForm.txtWhat2Do.value = 'SAVE_GVPAGE';
	}else{
		thisForm.txtWhat2Do.value = 'UPDATE_GVPAGE';	
	}
	thisForm.submit();	
}
function DeleteGV(id)
{
	if(id == ''){
	 	alert('Please select one Gift vouchure you want to Delete');
	 	return false;
	}
	else if (confirm("Do You really want to delete this Gift Vouchure"))
	{
	thisForm.txtWhat2Do.value = 'DELETE_GV';
	}
	thisForm.submit();
}
////////////////////////////////////////////////////////////////////  Contact JAvascript  Starts Here ///////////////////////////////////////////////
function DeleteContactEnquiry ()
{
	thisForm.txtWhat2Do.value = 'DELETE_CONTACT'; 
	thisForm.submit();
}
function SelectContact (CtId)
{
	$("hidContactId").value = CtId;
	thisForm.txtWhat2Do.value = 'SHOW_CONTACT'; 
	thisForm.submit();
}
function ShowDropDownMenu(count)
{   var passVariable;
	if ($('popup_container').style.display == 'block')
	{
		for (passVariable = 1; passVariable <= count ; passVariable++)
		{
			$('drop_down'+passVariable).style.display = 'none';	
		}
		$('popup_container').style.display = 'none';
	}
	else
	{
		for (passVariable = 1; passVariable <= count ; passVariable++)
		{
			$('drop_down'+passVariable).style.display = 'block';
		}
		$('popup_container').style.display = 'block';
		$('err_selected_option').style.visibility = 'hidden';
	}
}
function SetSelectedValue(thisVar,CategoryId,totalCount)
{
	ShowDropDownMenu(totalCount);
	$('selected_option').innerHTML = thisVar.innerHTML;
	$('hid_interest_id').value = CategoryId;
}
function changeOption(thisVar,CategoryId)
{
	thisVar.className='active_contact_list';
	$('selected_option').innerHTML = thisVar.innerHTML;
	$('hid_interest_id').value = CategoryId;
}

/**
	###############################Site Page Javascript Ends Here ###############################
*/
/**
	###############################Racing Page Javascript Starts Here ###############################
*/
function SelectRacing(rcId)
{
	$('hidRacingId').value 		= rcId;
	thisForm.txtWhat2Do.value 	= 'SHOW_RACING';
	thisForm.submit();
}
function AddRacing()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_RACING';	
	thisForm.submit();
}
function __SaveRacing(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text for Racing ");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	/*if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date of news ");
		$('txtDate').focus();
		return false;
	}*/
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteRacing()
{
	if ($('hidRacingId').value  == '')
	{	
		alert("Please Select a Racing");
		return false;
	}
	else if (confirm("Do you really want to delete this Racing"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_RACING';	
		thisForm.submit();		
	}
}
function EditRacing ()
{
	if ($('hidRacingId').value  == '')
	{	
		alert("Please Select a Racing");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_RACING';	
	thisForm.submit();
}
/**
	###############################News Page Javascript Ends Here ###############################
*/
/**
	###############################Delivery Offer Page Javascript Starts Here ###############################
*/
function __fnchideonoffer(){
	var	params = "&status=D&rdsel="+encodeURI($("rdbOff").value);
	new Ajax.Request('updateprd.php?action=offerstatus',{method:"get",parameters:params,onSuccess:offerstr,onFailure:dispError})
}

function __fncshowonoffer(){
	var	params = "&status=A&rdsel="+encodeURI($("rdbOn").value);
	new Ajax.Request('updateprd.php?action=offerstatus',{method:"get",parameters:params,onSuccess:offerstr,onFailure:dispError})
}
function offerstr(reqObj){
	document.getElementById('onoffer').innerHTML = reqObj.responseText;
}
function dispError(){
	
}
function __fncSaveDelofferDetails(){
	thisForm.txtWhat2Do.value = 'SAVE_DELIVERY_OFFER';	
	thisForm.submit();
}

/**
	###############################Delivery Offer Page Javascript Ends Here ###############################
*/
/**
	###############################Kartingtuition Page Javascript Starts Here ###############################
*/
function SelectKartingtuition(rcId)
{
	$('hidKartingtuitionId').value 		= rcId;
	thisForm.txtWhat2Do.value 	= 'SHOW_KARTING_TUITION';
	thisForm.submit();
}
function AddKartingtuition()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_KARTING_TUITION';	
	thisForm.submit();
}
function __SaveKartingtuition(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text for Racing ");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	/*if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date of news ");
		$('txtDate').focus();
		return false;
	}*/
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteKartingtuition()
{
	if ($('hidKartingtuitionId').value  == '')
	{	
		alert("Please Select a Racing");
		return false;
	}
	else if (confirm("Do you really want to delete this Racing"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_KARTING_TUITION';	
		thisForm.submit();		
	}
}
function EditKartingtuition ()
{
	if ($('hidKartingtuitionId').value  == '')
	{	
		alert("Please Select a Karting tuition option");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_KARTING_TUITION';	
	thisForm.submit();
}
/**
	###############################News Page Javascript Ends Here ###############################
*/
/**
	###############################Drivers Page Javascript Starts Here ###############################
*/
function SelectDrivers(rcId)
{
	$('hidDriversId').value 		= rcId;
	thisForm.txtWhat2Do.value 	= 'SHOW_DRIVERS';
	thisForm.submit();
}
function AddDrivers()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_DRIVERS';	
	thisForm.submit();
}
function __SaveDrivers(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text for Drivers");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	/*if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date of news ");
		$('txtDate').focus();
		return false;
	}*/
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteDrivers()
{
	if ($('hidDriversId').value  == '')
	{	
		alert("Please Select a Driver");
		return false;
	}
	else if (confirm("Do you really want to delete this Driver \n this drivers gallery images and team images will also delete "))
	{
		thisForm.txtWhat2Do.value = 'DELETE_DRIVERS';	
		thisForm.submit();		
	}
}
function EditDrivers ()
{
	if ($('hidDriversId').value  == '')
	{	
		alert("Please Select a Drivers");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_DRIVERS';	
	thisForm.submit();
}
/**
	###############################Drivers Page Javascript Ends Here ###############################
*/
function __fncdispalydriverssettingsmenu(){
	$('driversmenu').style.display = 'block';	
	return false;
}
function __fncnondriverssettingsmenu(){
	$('driversmenu').style.display = 'none';	
	return false;
}
/**
	###############################Drivers Album Image Gallery Page Javascript Starts Here ###############################
*/
function SelectDriversAlbumImggallry(dvimgId)
{
	$('hidDriversalimgglId').value 		= dvimgId;
	thisForm.txtWhat2Do.value 	= 'SHOW_DRIVER_ALBUM_GALLERY';
	thisForm.action='driversalbumgallery.php';
	thisForm.submit();
}
function AddDriversAlbumImggallry()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_ALBUM_GALLERY';	
	thisForm.submit();
}
function __SaveDriversalbumImggallry(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	if(constantValue =='SAVE_ALBUM_GALLERY'){
		if (trim($('txtMainimage').value) == '')
		{
			alert("Please select image ");
			$('txtMainimage').focus();
			return false;
		}
	}
	if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date");
		$('txtDate').focus();
		return false;
	}
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteDriversAlbumImggallry()
{
	if ($('hidDriversalimgglId').value  == '')
	{	
		alert("Please Select a Album");
		return false;
	}
	else if (confirm("Do you really want to delete this Album"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_DRIVERS_ALBUM_GALLERY';	
		thisForm.submit();		
	}
}
function EditDriversAlbumImggallry ()
{
	if ($('hidDriversalimgglId').value  == '')
	{	
		alert("Please Select a Album");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_DRIVERS_ALBUM_GALLERY';	
	thisForm.submit();
}
function __fncViewAlbumPictureGallery(dvimgId){
	$('hidDriversalimgglId').value 		= dvimgId;
	thisForm.action 	= 'driversimagegallery.php';
	thisForm.submit();
}
/**
	###############################Drivers Album Image Gallery Page Javascript Ends Here ###############################
*/
/**
	###############################Drivers Image Gallery Page Javascript Starts Here ###############################
*/
function SelectDriversImggallry(dvimgId)
{
	$('hidDriversimgglId').value 		= dvimgId;
	thisForm.txtWhat2Do.value 	= 'SHOW_GALLERY';
	thisForm.submit();
}
function AddDriversImggallry()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_GALLERY';	
	thisForm.submit();
}
function __SaveDriversImggallry(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	if(constantValue =='SAVE_GALLERY'){
		if (trim($('txtMainimage').value) == '')
		{
			alert("Please select image ");
			$('txtMainimage').focus();
			return false;
		}
	}
	if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date");
		$('txtDate').focus();
		return false;
	}
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteDriversImggallry()
{
	if ($('hidDriversimgglId').value  == '')
	{	
		alert("Please Select a Driver Image");
		return false;
	}
	else if (confirm("Do you really want to delete this Image"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_DRIVERS_GALLERY';	
		thisForm.submit();		
	}
}
function EditDriversImggallry ()
{
	if ($('hidDriversimgglId').value  == '')
	{	
		alert("Please Select a Image");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_DRIVERS_GALLERY';	
	thisForm.submit();
}
/**
	###############################Drivers Image Gallery Page Javascript Ends Here ###############################
*/
/**
	###############################Drivers Team Album Image Gallery Page Javascript Starts Here ###############################
*/
function SelectDriverstmAlbumImggallry(dvimgId)
{
	$('hidDriverstmalbmimgglId').value 		= dvimgId;
	thisForm.txtWhat2Do.value 	= 'SHOW_DRIVER_TEAM_ALBUM_GALLERY';
	thisForm.action='driversteamalbumgallery.php';
	thisForm.submit();
}
function AddDriversTmAlbumImggallry()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_TEAM_ALBUM_GALLERY';	
	thisForm.submit();
}
function __SaveDriverstmAlbumImggallry(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	if(constantValue =='SAVE_DRIVER_TEAM_ALBUM_GALLERY'){
		if (trim($('txtMainimage').value) == '')
		{
			alert("Please select image ");
			$('txtMainimage').focus();
			return false;
		}
	}
	if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date");
		$('txtDate').focus();
		return false;
	}
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteDriversTmAlbumImggallry()
{
	if ($('hidDriverstmalbmimgglId').value  == '')
	{	
		alert("Please Select a Album");
		return false;
	}
	else if (confirm("Do you really want to delete this album"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_DRIVERS_TEAM_ALBUM_GALLERY';	
		thisForm.submit();		
	}
}
function EditDriversTmAlbumImggallry ()
{
	if ($('hidDriverstmalbmimgglId').value  == '')
	{	
		alert("Please Select a Album");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_DRIVERS_TEAM_ALBUM_GALLERY';	
	thisForm.submit();
}
function __fncViewTeamAlbumPictureGallery(dvimgId){
	$('hidDriverstmalbmimgglId').value 		= dvimgId;
	thisForm.action 	= 'driversteamgallery.php';
	thisForm.submit();
}
/**
	###############################Drivers Team Album Image Gallery Page Javascript Ends Here ###############################
*/







/**
	###############################Drivers Team Image Gallery Page Javascript Starts Here ###############################
*/
function SelectDriverstmImggallry(dvimgId)
{
	$('hidDriverstmimgglId').value 		= dvimgId;
	thisForm.txtWhat2Do.value 	= 'SHOW_DRIVER_TEAM_GALLERY';
	thisForm.submit();
}
function AddDriversTmImggallry()
{
	thisForm.txtWhat2Do.value = 'SHOW_ADD_TEAM_GALLERY';	
	thisForm.submit();
}
function __SaveDriverstmImggallry(constantValue)
{
	if (trim($('title').value) == '')
	{
		alert("Please enter a title text");
		$('title').focus();
		return false;
	}
	/*if (trim($('longdesc').innerHTML) == '')
	{
		alert("Please enter a Description  for news ");
		$('longdesc').focus();
		return false;
	}*/
	if(constantValue =='SAVE_DRIVER_TEAM_GALLERY'){
		if (trim($('txtMainimage').value) == '')
		{
			alert("Please select image ");
			$('txtMainimage').focus();
			return false;
		}
	}
	if (trim($('txtDate').value) == '')
	{
		alert("Please enter a date");
		$('txtDate').focus();
		return false;
	}
	/*else
	{*/
		thisForm.txtWhat2Do.value = constantValue;	
		thisForm.submit();	
	//}
}
function DeleteDriversTmImggallry()
{
	if ($('hidDriverstmimgglId').value  == '')
	{	
		alert("Please Select a Driver Team Image");
		return false;
	}
	else if (confirm("Do you really want to delete this Image"))
	{
		thisForm.txtWhat2Do.value = 'DELETE_DRIVERS_TEAM_GALLERY';	
		thisForm.submit();		
	}
}
function EditDriversTmImggallry ()
{
	if ($('hidDriverstmimgglId').value  == '')
	{	
		alert("Please Select a Image");
		return false;
	}
	thisForm.txtWhat2Do.value = 'EDIT_DRIVERS_TEAM_GALLERY';	
	thisForm.submit();
}
/**
	###############################Drivers Team Image Gallery Page Javascript Ends Here ###############################
*/