﻿var vhidApplicationPath;
var vddlCarOwner, vtxtCarOwner2 , vtxtArCarOwner2, vtxtCarOwnerTel, vddlCarOwnerType;



// Changes the cursor to hand_Projects



function OnMouseOver_Buttons( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "OverButtons";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_Buttons( vControl )
{
	try
	{
		vControl.className = "Buttons";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

//////////////////////////////////////
function OnMouseOver_ButtonsRed( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "OverButtonsRed";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsRed( vControl )
{
	try
	{
		vControl.className = "ButtonsRed";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
//////////////////////////////////////

/////////////////////////////////////
function OnMouseOver_ButtonsAr( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "OnArabicLink";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsAr( vControl )
{
	try
	{
		vControl.className = "ArabicLink";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
/////////////////////////////////////


/////////////////////////////////////
function OnMouseOver_ButtonsIndex( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "OverButtonsRedIndex";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsIndex( vControl )
{
	try
	{
		vControl.className = "ButtonsRedIndex";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
/////////////////////////////////////




/////////////////////////////////////
function OnMouseOver_ButtonsIndexArabic( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "ArabicButtonsRedIndexOver";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsIndexArabic( vControl )
{
	try
	{
		vControl.className = "ArabicButtonsRedIndex";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
/////////////////////////////////////


/////////////////////////////////////
function OnMouseOver_ButtonsInternalArabic( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "ArabicButtonsRedInternal";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsInternalArabic( vControl )
{
	try
	{
		vControl.className = "ArabicButtonsRed";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
/////////////////////////////////////





/////////////////////////////////////
function OnMouseOver_ButtonsIndexAr( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "OnArablicLinkIndex";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_ButtonsIndexAr( vControl )
{
	try
	{
		vControl.className = "ArablicLinkIndex";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}
/////////////////////////////////////

//***************************
function OnMouseOver_Projects( vControl )
{

	try
	{
		var varControl ;
		varControl = document.getElementById( vControl );
		varControl.style.textDecorationUnderline = true;
		varControl.style.cursor = 'hand';
		//vControl.className = "MnuText_Over";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_Projects( vControl )
{
	try
	{
		var varControl ;
		varControl = document.getElementById( vControl );
		varControl.style.textDecorationUnderline = false;
		//varControl.className = "MnuText_Out";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}



function OnMouseOver( vControl )
{
	try
	{
		vControl.style.textDecorationUnderline = true;
		vControl.style.cursor = 'hand';
	
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut( vControl )
{
	try
	{
		vControl.className = "MnuText_Out";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOver_H( vControl )
{
	try
	{
		vControl.style.textDecorationUnderline = true;
		vControl.style.cursor = 'hand';
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOut_H( vControl )
{
	try
	{
		vControl.style.textDecorationUnderline = false;
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOverHome( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "MnuText_OverHome";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}


function OnMouseOutHome( vControl )
{
	try
	{
		vControl.className = "MnuText_OutHome";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}




function GetApplicationPath()
{
	try
	{
		vhidApplicationPath = document.getElementById( "__hhidApplicationPath" );
	}
	catch( ex )
	{}
}




function OpenPageInSameWindow( vTargetPage )
{
	
	GetApplicationPath();
	
//	alert(vTargetPage);
	

	window.location = vhidApplicationPath.value + vTargetPage;
}

function OpenPageInSameProjectWindow( vTargetPage )
{
	
	GetApplicationPath();
	
//	alert(vTargetPage);
	

	window.location = vhidApplicationPath.value +'/'+ vTargetPage;
}


function OpenPageInSameProjectWindowAr( vTargetPage )
{
	
	GetApplicationPath();
	
//	alert(vTargetPage);
	

	window.location =  vhidApplicationPath.value + '/ArabicPages/' + vTargetPage;
}

function OpenPageInSameWindowWithID( vTargetPage )
{
	
	var vID;
	
	vID = document.getElementById( "SelectedProjectId" ).value;
	
	GetApplicationPath();
	
	vTargetPage = vTargetPage + vID
	
	//alert(vTargetPage);
	
	window.location = vhidApplicationPath.value + vTargetPage;
}

function SwapImageAndCursor( vControl, imgImagetoReplace , blnOver )
{
	
	GetApplicationPath();
	
	if( ! vhidApplicationPath )
	{
		
		return;
	}

	
	if ( blnOver )
	
		vControl.style.cursor = 'hand';
	else
		vControl.style.cursor = 'default';
	
	
	vControl.src = vhidApplicationPath.value + "/" + imgImagetoReplace;
}

//GhassanT 26.04.2007
/////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function fillProjectInfo_Index( imgImagetoLoad, descToShow, SelectedProj_ID, smallImgTo, NameToShow, locToShow )
{
	try
	{
	
	GetApplicationPath();
	
	if( ! vhidApplicationPath )
	{
		
		return;
	}
	
	var vControl;
	var vControlDesc;
	var vSelectedProjectID;
	
	var smallImg;
		
	smallImg = document.getElementById( smallImgTo );
			
	vControl = document.getElementById( "gg" );
	vControlDesc = document.getElementById( "DescTD" );
	vSelectedProjectID = document.getElementById( "SelectedProjectId" );
	
	vControl.style.cursor = 'hand';
	smallImg.style.cursor = 'hand';
	
//	alert(descToShow);
		vControl.src = vhidApplicationPath.value + "/" + imgImagetoLoad;
		vControlDesc.innerText = NameToShow + '\n' + locToShow;
	//	vControlDesc.innerText = descToShow;
		
		vSelectedProjectID.value = "";
		vSelectedProjectID.value = SelectedProj_ID;
	//	alert(vSelectedProjectID.value);
	}
	catch( ex )
	{
	}
}
/////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//GhassanT 26.04.2007
//not used for now
/////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function ResetProjectInfo_Index( imgImagetoLoad, descToShow)
{
	try
	{
	
	GetApplicationPath();
	
	if( ! vhidApplicationPath )
	{
		
		return;
	}
	
	var vControl;
	var vControlDesc;
	vControl = document.getElementById( "gg" );
	vControlDesc = document.getElementById( "DescTD" );
	
//	alert(descToShow);
		vControl.src = vhidApplicationPath.value + "/" + imgImagetoLoad;
		vControlDesc.innerText = descToShow;
	}
	catch( ex )
	{
	}
}
/////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


function TrimText(str)
{
	return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
}

function ConfirmDeletion( strItemName , blnIsUsed , strPageName)
{
	try
	{
		if( blnIsUsed == 'True' )
		{
			alert( "This " + strPageName + " is used and cannot be deleted!" );
			return false;
		}
		else
		{
			if( confirm( 'Are you sure you want to delete: "' + strItemName + '"?' ) )
			{
				return true;
			}
			else
				return false;
		}
	}
	catch( ex )
	{
	}
}

function ConfirmProjectDeletion( strItemName , blnIsUsed , strPageName)
{
	try
	{
		if( blnIsUsed == 'True' )
		{
			alert( "This " + strPageName + " is used and cannot be deleted!" );
			return false;
		}
		else
		{
			if( confirm( 'Are you sure you want to delete: "' + strItemName + '" \nand all its Related Information and photos?' ) )
			{
				return true;
			}
			else
				return false;
		}
	}
	catch( ex )
	{
	}
}

function ConfirmFeedbackDeletion( strItemName )
{
	try
	{
		if( confirm( 'Are you sure you want to delete: "' + strItemName + '"?' ) )
		{
			return true;
		}
		else
			return false;
	}
	catch( ex )
	{
	}
}

function ConfirmDeletionItem( strItemName )
{
	try
	{
		if( confirm( 'Are you sure you want to delete: "' + strItemName + '"?' ) )
		{
			return true;
		}
		else
			return false;
	}
	catch( ex )
	{
	}
}

function CannotBeEdited( strItemName , blnIsUsed , strPageName)
{
	try
	{
		if( blnIsUsed == 'True' )
		{
			alert( "This " + strPageName + " is online and cannot be edited!" );
			return false;
		}
		else
		{
			return true;
		}
		
	}
	catch( ex )
	{
	}
}

function ConfirmItemDeletion( strItemName , strItemCount )
{
	try
	{
		if( confirm( 'Are you sure you want to delete: "' + strItemName + '"?' ) )
		{
			if( parseInt( strItemCount ) > 0 ) 
			{
				alert( 'You cannot delete: "' + strItemName + '" because it is used' );
				return false;
			}
			else
				return true;
		}
	}
	catch( ex )
	{
	}
}


function OnMouseOverImg( vControl )
{
	try
	{
		vControl.parentElement.style.cursor = 'hand';
		vControl.parentElement.className = "BorderOn";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOutImg( vControl )
{
	try
	{
		vControl.parentElement.style.cursor = 'default';
		vControl.parentElement.className = "BorderOut";
	}
	catch( ex )
	{
		alert( 'OnMouseOutImg : ' + ex.message )
	}
}



function GetControlsByID()
{
	vddlCarOwner = document.getElementById( "wddlCarOwner" );
	vtxtCarOwner2 = document.getElementById( "wtxtCarOwner2" );
	vtxtArCarOwner2 = document.getElementById( "wtxtArCarOwner2" );
	vtxtCarOwnerTel = document.getElementById( "wtxtCarOwnerTel" );
	vddlCarOwnerType = document.getElementById( "wddlCarOwnerType" );
}

function CheckCarOwnerData()
{
	try
	{
		var strErrMsg;
		strErrMsg = "";
		
		
		GetControlsByID();
		
		if( vddlCarOwnerType.value != -1 )
		{
			if( vddlCarOwnerType.value == 1 )
			{
				if( TrimText( vtxtCarOwner2.value ) == "" )
				{
					strErrMsg += "Please enter the car owner english name\n";
				}

				if( TrimText( vtxtArCarOwner2.value ) == "" )
				{
					strErrMsg += "Please enter the car owner arabic name\n";
				}

				if( TrimText( vtxtCarOwnerTel.value ) == "" )
				{
					strErrMsg += "Please enter the car owner telephone\n";
				}
			}
			else
			{
				if( vddlCarOwner.value == -1 )
				{
					strErrMsg += "Please select a car owner\n";
				}
			}
		}
		
		if( strErrMsg != "" )
		{
			alert( strErrMsg );
			return false;
		}
		
		return true;
	}
	catch( ex )
	{
		alert( ex.message );
	}
}


function GetCarOwnerControlsByID()
{
	vddlCarOwnerHomeTel = document.getElementById( "wtxtCarOwnerHomeTelNo" );
	vtxtCarOwnerOffTel = document.getElementById( "wtxtCarOwnerOfficeTelNo" );
	vtxtCarOwnerMob = document.getElementById( "wtxtCarOwnerMobileNo" );
}

function GetCarSellerControlsByID()
{
	vtxtCarOwnerTel = document.getElementById( "wtxtTelephone" );
	vtxtCarOwnerMob = document.getElementById( "wtxtMobile" );
	vtxtCarOwnerEmail = document.getElementById( "wtxtEmail" );
}


function ValidateCarOwnerMandatoryFields( source , arguments )
{
	try
	{
		
		GetCarOwnerControlsByID();

		if( 
			( TrimText( vddlCarOwnerHomeTel.value ) == "" ) &&
			( TrimText( vtxtCarOwnerOffTel.value ) == "" ) &&
			( TrimText( vtxtCarOwnerMob.value ) == "" ) 
			 )
		{
			arguments.IsValid = false;
		}
		else
		{
			arguments.IsValid = true;
		}
	}
	catch( ex )
	{
		alert( 'ValidateMandatoryFields : ' + ex.message );
	}	
}


function ValidateCarSellerMandatoryFields( source , arguments )
{
	try
	{
		
		GetCarSellerControlsByID();

		if( 
			( TrimText( vtxtCarOwnerTel.value ) == "" ) &&
			( TrimText( vtxtCarOwnerMob.value ) == "" ) &&
			( TrimText( vtxtCarOwnerEmail.value ) == "" ) 
			 )
		{
			arguments.IsValid = false;
		}
		else
		{
			arguments.IsValid = true;
		}
	}
	catch( ex )
	{
		alert( 'ValidateMandatoryFields : ' + ex.message );
	}	
}



function ItemSelected( strRenDel )
{
	try
	{
		var intCntr;
		var vDGCars;
		vDGCars = document.getElementById( "dgCars" );
		var blnItemChecked;
		blnItemChecked = false;
		for( intCntr = 1 ; intCntr < vDGCars.children(0).children.length - 1 ; intCntr++ )
		{
			if( vDGCars.children(0).children(intCntr).children(0).children(0).checked )
			{
				blnItemChecked = true;
				break;
			}
		}
		
		if( !blnItemChecked )
		{
			alert( "There is no checked item to " + strRenDel );
			return false;
		}
		else
			return true;
	}
	catch( ex ){}	
}

function PowerWindowChecked()
{
	try
	{
		var vchkPowerWindows;
		vchkPowerWindows = document.getElementById( "ChkPowerWindows" );
		vchkFrontAndRearPowerWindows = document.getElementById( "ChkFrontAndRearPowerWindows" );
		var vSpan;
		vSpan = vchkFrontAndRearPowerWindows.parentElement;
		if( vchkPowerWindows.checked )
		{
			vchkFrontAndRearPowerWindows.disabled = false;
			vSpan.childNodes(1).style.color = "black";
		}
		else
		{
			vchkFrontAndRearPowerWindows.disabled = true;
			vchkFrontAndRearPowerWindows.checked = false;
			vSpan.childNodes(1).style.color = "gray";
		}
	}
	catch( ex ){}
}

function CheckManYear( source , arguments )
{
	try
	{
		var vManYearFrom, vManYearTo;
		vManYearFrom = document.getElementById( "wddlCarManYearFrom" );
		vManYearTo = document.getElementById( "wddlCarManYearTo" );
		
		if( vManYearFrom.selectedIndex != 0 )
		{
			if( vManYearTo.selectedIndex != 0 )
			{
				if( vManYearFrom.value > vManYearTo.value )
					arguments.IsValid = false;
				else
					arguments.IsValid = true;
			}
		}
	}
	catch( ex ){}
}


function CheckIfColorIsSelected( intColorSelected )
{
	try
	{
		var vddlExteriorColor1, vddlExteriorColor2, vddlExteriorColor3;
		vddlExteriorColor1 = document.getElementById( "wddlExteriorColor1" );
		vddlExteriorColor2 = document.getElementById( "wddlExteriorColor2" );
		vddlExteriorColor3 = document.getElementById( "wddlExteriorColor3" );

		if( intColorSelected == 1 )
		{
			if( vddlExteriorColor1.selectedIndex != 0 )
			{
				vddlExteriorColor2.disabled = false;
			}
			else
			{
				vddlExteriorColor2.disabled = true;
				vddlExteriorColor2.selectedIndex = 0;
				vddlExteriorColor3.disabled = true;
				vddlExteriorColor3.selectedIndex = 0;
			}
		}
		else if( intColorSelected == 2 )
		{
			if ( vddlExteriorColor2.selectedIndex != 0 )
			{
				vddlExteriorColor3.disabled = false;
			}
			else
			{
				vddlExteriorColor3.disabled = true;
				vddlExteriorColor3.selectedIndex = 0;
			}
		}
	}
	catch( ex )
	{
		alert( ex.message );
	}
}

function CheckIfPhotoIsFilled( intPhotoNo )
				{
					try
					
					{
					
						var vfilePhoto1, vfilePhoto2, vfilePhoto3, vfilePhoto4, vfilePhoto5, vfilePhoto6;
						vfilePhoto1 = document.getElementById( "fileCarPhotoToUpload" );
						vfilePhoto2 = document.getElementById( "fileCarPhoto2ToUpload" );
						vfilePhoto3 = document.getElementById( "fileCarPhoto3ToUpload" );
						vfilePhoto4 = document.getElementById( "fileCarPhoto4ToUpload" );
						vfilePhoto5 = document.getElementById( "fileCarPhoto5ToUpload" );
						vfilePhoto6 = document.getElementById( "fileCarPhoto6ToUpload" );
					
						if( intPhotoNo == 1 )
						{
							if ( (vfilePhoto1.value) != "" )
								{
								vfilePhoto2.disabled = false;
								}
							
						}
						
						if( intPhotoNo == 2 )
						{
							if ( (vfilePhoto1.value) != "" )
							{
								vfilePhoto2.disabled = false;
							}
							else
							{
								vfilePhoto2.disabled = true;
								vfilePhoto3.disabled = true;
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 3 )
						{
							if ( (vfilePhoto2.value) != "" )
							{
								vfilePhoto3.disabled = false;
							}
							else
							{
								vfilePhoto3.disabled = true;
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 4 )
						{
							if ( (vfilePhoto3.value) != "" )
							{
								vfilePhoto4.disabled = false;
							}
							else
							{
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 5 )
						{
							if ( (vfilePhoto4.value) != "" )
							{
								vfilePhoto5.disabled = false;
							}
							else
							{
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 6 )
						{
							if ( (vfilePhoto5.value) != "" )
							{
								vfilePhoto6.disabled = false;
							}
							else
							{
								vfilePhoto6.disabled = true;
							}
						}
					}
					catch( ex )
					{
						alert( ex.message );
					}
				}
				
function CheckFilledPhotos()
{
	try
	{
		        
		var strErrMsg;
		strErrMsg = "";
		
		
			var vfilePhoto1, vfilePhoto2, vfilePhoto3, vfilePhoto4, vfilePhoto5, vfilePhoto6;
			vfilePhoto1 = document.getElementById( "fileCarPhotoToUpload" );
			vfilePhoto2 = document.getElementById( "fileCarPhoto2ToUpload" );
			vfilePhoto3 = document.getElementById( "fileCarPhoto3ToUpload" );
			vfilePhoto4 = document.getElementById( "fileCarPhoto4ToUpload" );
			vfilePhoto5 = document.getElementById( "fileCarPhoto5ToUpload" );
			vfilePhoto6 = document.getElementById( "fileCarPhoto6ToUpload" );
		
		 if (TrimText(vfilePhoto6.value) != "")
		 {
		 
		 if ((TrimText(vfilePhoto1.value) == "") ||
                (TrimText(vfilePhoto2.value) == "") ||
                (TrimText(vfilePhoto3.value) == "") ||
                (TrimText(vfilePhoto4.value) == "") ||
                (TrimText(vfilePhoto5.value) == "")) 
                {
      
                
                alert("Please upload the car photos in order\n");
				return false;
                }		
		 } 
                
		 if (TrimText(vfilePhoto5.value) != "")
		 {
		 if ((TrimText(vfilePhoto1.value) == "") ||
                (TrimText(vfilePhoto2.value) == "") ||
                (TrimText(vfilePhoto3.value) == "") ||
                (TrimText(vfilePhoto4.value) == ""))
                {
               
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
               
         if (TrimText(vfilePhoto4.value) != "")
		 {
		 if ((TrimText(vfilePhoto1.value) == "") ||
                (TrimText(vfilePhoto2.value) == "") ||
                (TrimText(vfilePhoto3.value) == ""))
                {
               
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		 
		 if (TrimText(vfilePhoto3.value) != "")
		 {
		 if ((TrimText(vfilePhoto1.value) == "") ||
                (TrimText(vfilePhoto2.value) == ""))
                
                {
                
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		    
		  if (TrimText(vfilePhoto2.value) != "")
		 {
		 if ((TrimText(vfilePhoto1.value) == ""))
                              
                {
                
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		
		
		return true;
	}
	catch( ex )
	{
		alert( ex.message );
	}
}

function CheckIfImageIsFilled( intPhotoNo )
				{
					try
					
					{
					
						var vfilePhoto1, vfilePhoto2, vfilePhoto3, vfilePhoto4, vfilePhoto5, vfilePhoto6;
						vfilePhoto1 = document.getElementById( "ImgCarPhoto" );
						vfilePhoto2 = document.getElementById( "ImgCarPhoto2" );
						vfilePhoto3 = document.getElementById( "ImgCarPhoto3" );
						vfilePhoto4 = document.getElementById( "ImgCarPhoto4" );
						vfilePhoto5 = document.getElementById( "ImgCarPhoto5" );
						vfilePhoto6 = document.getElementById( "ImgCarPhoto6" );
					
						if( intPhotoNo == 1 )
						{
							if ( (vfilePhoto1.value) != "" )
								{
								vfilePhoto2.disabled = false;
								}
							
						}
						
						if( intPhotoNo == 2 )
						{
							if ( (vfilePhoto1.value) != "" )
							{
								vfilePhoto2.disabled = false;
							}
							else
							{
								vfilePhoto2.disabled = true;
								vfilePhoto3.disabled = true;
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 3 )
						{
							if ( (vfilePhoto2.value) != "" )
							{
								vfilePhoto3.disabled = false;
							}
							else
							{
								vfilePhoto3.disabled = true;
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 4 )
						{
							if ( (vfilePhoto3.value) != "" )
							{
								vfilePhoto4.disabled = false;
							}
							else
							{
								vfilePhoto4.disabled = true;
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 5 )
						{
							if ( (vfilePhoto4.value) != "" )
							{
								vfilePhoto5.disabled = false;
							}
							else
							{
								vfilePhoto5.disabled = true;
								vfilePhoto6.disabled = true;
							}
						}
						else if( intPhotoNo == 6 )
						{
							if ( (vfilePhoto5.value) != "" )
							{
								vfilePhoto6.disabled = false;
							}
							else
							{
								vfilePhoto6.disabled = true;
							}
						}
					}
					catch( ex )
					{
						alert( ex.message );
					}
				}
			
function CheckFilledImages()
{
	try
	{
		        
		var strErrMsg;
		strErrMsg = "";
		
		
			var vfilePhoto1, vfilePhoto2, vfilePhoto3, vfilePhoto4, vfilePhoto5, vfilePhoto6;
			vfilePhoto1 = document.getElementById( "ImgCarPhoto" );
			vfilePhoto2 = document.getElementById( "ImgCarPhoto2" );
			vfilePhoto3 = document.getElementById( "ImgCarPhoto3" );
			vfilePhoto4 = document.getElementById( "ImgCarPhoto4" );
			vfilePhoto5 = document.getElementById( "ImgCarPhoto5" );
			vfilePhoto6 = document.getElementById( "ImgCarPhoto6" );
	
		 if ((vfilePhoto6.src) != "")
		 {
		 if (((vfilePhoto1.src) == "") ||
                ((vfilePhoto2.src) == "") ||
                ((vfilePhoto3.src) == "") ||
                ((vfilePhoto4.src) == "") ||
                ((vfilePhoto5.src) == "")) 
                {
      
                
                alert("Please upload the car photos in order\n");
				return false;
                }		
		 } 
                
		 if ((vfilePhoto5.src) != "")
		 {
		 if (((vfilePhoto1.src) == "") ||
                ((vfilePhoto2.src) == "") ||
                ((vfilePhoto3.src) == "") ||
                ((vfilePhoto4.src) == ""))
                {
               
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
               
         if ((vfilePhoto4.src) != "")
		 {
		 if (((vfilePhoto1.src) == "") ||
                ((vfilePhoto2.src) == "") ||
                ((vfilePhoto3.src) == ""))
                {
               
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		 
		 if ((vfilePhoto3.src) != "")
		 {
		 if (((vfilePhoto1.src) == "") ||
                ((vfilePhoto2.src) == ""))
                
                {
                
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		    
		  if ((vfilePhoto2.src) != "")
		 {
		 if (((vfilePhoto1.src) == ""))
                              
                {
               
                alert("Please upload the car photos in order\n");
				return false;
                }
		 } 
		
		
		return true;
	}
	catch( ex )
	{
		alert( ex.message );
	}
}

function OnMouseOverHomePoll( vControl )
{
	try
	{
		vControl.style.cursor = 'hand';
		vControl.className = "PollLink_Over";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOutHomePoll( vControl )
{
	try
	{
		vControl.className = "PollLink_Out";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

var vPollID

function OpenPollInSameWindow( vTargetPage )
{
	try
	{
	
		vPollID = document.getElementById( "hhidPollID" ).value;
		
		
		GetApplicationPath();
	
		
		window.location = vhidApplicationPath.value + vTargetPage + "?PollID=" + vPollID;
	
	}
	catch( ex )
	{}
}

function OnMouseOverFeaturedCar( vControl )
{
	try
	{
		var Control
		Control = document.getElementById( vControl );
		
		Control.style.cursor = 'hand';
		
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}


function OnMouseOutFeaturedCar( vControl )
{
	try
	{
		var Control
		Control = document.getElementById( vControl );
		
		vControl.className = "PollLink_Out";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OpenTellAFriend(varSource, CarID, PhotoPath)
{

	try
	{
	
		var strCarID = CarID;
		var vPhotoPath =document.getElementById( PhotoPath );
		var vPhotoPathSrc;
		if (vPhotoPath == null)
		{
			vPhotoPathSrc = "";
		}
		else
		{
			vPhotoPathSrc = vPhotoPath.src;
		} 
		var strQueryString = "intCarID=" + strCarID + "&strPhotoPath=" + vPhotoPathSrc;
		
		var vOptions = "height=300,width=550,status=yes,toolbar=yes,menubar=no,location=no,scrollbars=yes";
		var strAppPath = document.getElementById( "__hhidApplicationPath" ).value;
		if(varSource == "Arabic")
		{
		
		var retValue = window.open( strAppPath + '/Arabic/TellAFriend.aspx?' + strQueryString, null, vOptions );
		}
		else
		{
		
		var retValue = window.open( strAppPath + '/TellAFriend.aspx?' + strQueryString, null, vOptions );
		}
		
	
	}
	catch( ex )
	{}
}

function EmptyTextBox(Control)
{
	try
	{
	var vControl= document.getElementById(Control);
	vControl.innerText = "";
	}
	catch( ex )
	{}
}

function ShowHideRows(bool1, bool2, bool3)
{

try
	{
	var vControl1= document.getElementById("trHistory");
	var vControl2= document.getElementById("trMission");
	var vControl3= document.getElementById("trVision");
	
	if(vControl1 != null)
	{
		if (bool1 == true)
		{
			vControl1.className = "Visible";
		}
		else
		{
			vControl1.className = "Hidden";
		}
	}
	
	if(vControl2 !=null)
	{
		if (bool2 == true)
		{
			vControl2.className = "Visible";
		}
		else
		{
			vControl2.className = "Hidden";
		}
	}
	
	if(vControl3 != null)
	{ 
		if (bool3 == true)
		{
			vControl3.className = "Visible";
		}
		else
		{
			vControl3.className = "Hidden";
		}
	}
	
	

	}
	catch( ex )
	{
		alert( ex.message )
	}
}

function SetText(RowID, Language)
{
try
	{
		var vControl1= document.getElementById("tdHistory");
		if( Language == "English")
		{
			if(RowID==1)
			{
				vControl1.innerText="History";
			}
			else
			if(RowID==2)
			{
				vControl1.innerText="Mission";
			}
			else
			{
				vControl1.innerText="Vision";
			}
		}
		else
		{
			if(RowID==1)
			{
				vControl1.innerText="التاريخ";
			}
			else
			if(RowID==2)
			{
				vControl1.innerText="المهمة";
			}
			else
			{
				vControl1.innerText="الرؤية";
			}
		}
	
	}
	catch( ex )
	{
		alert( ex.message )
	}
}

	function HideShow(strElement1Status,strElement2Status,strElement3Status)
{
	try
	{
		var vTD1;
		var vTD2;
		var vTD3;
		var vTD4;
		
		vTD1 = document.getElementById( "tdRes" );
		vTD2 = document.getElementById( "trRes" );
		vTD3 = document.getElementById( "tdSrch" );
		vTD4 = document.getElementById( "trShowAll" );
	
		vTD1.style.display = strElement1Status;
		vTD2.style.display = strElement1Status;
		vTD3.style.display = strElement2Status;
		vTD4.style.display = strElement3Status;
			
	}
	catch( ex )
	{
	}
}

function SelectAll()
{
	try
	{
		var vDGContact;
		var vCBSelect;
		var intCntr;
		var boolCheck;
					
		vDGContact = document.getElementById( "dgContactList" );
		vCBSelect = document.getElementById( "cbSelectAll" );
								
		if( vCBSelect.checked )
		{
			boolCheck = true;
			
		}
		else
		{
			boolCheck = false;
			
		}
				
		
		for( intCntr = 1 ; intCntr < vDGContact.children(0).children.length - 1 ; intCntr++ )
		{
			
			vDGContact.children(0).children(intCntr).children(3).children(0).children(0).checked = boolCheck;
		}
						
	}
	catch( ex )
	{
	}
}

function OpenPrintList2()
{
	try
	{
	alert('hi');
		var vDGContact;
		var intCntr;
		var strQueryString1 = "";
		var strQueryString2 = "";
		
		vDGContact = document.getElementById( "dgContactList" );
		
		strQueryString1 = strQueryString1 + "strID1=";
		strQueryString2 = strQueryString2 + "strID2=";
		
		for( intCntr = 1 ; intCntr < vDGContact.children(0).children.length - 1 ; intCntr++ )
		{
			if( vDGContact.children(0).children(intCntr).children(3).children(0).attributes( "ContactItemType" ).value == "1" )
			{
				strQueryString1 = strQueryString1 + vDGContact.children(0).children(intCntr).children(3).children(0).attributes("ContactItemID").value + ",";
			}
			else
			{
				strQueryString2 = strQueryString2 + vDGContact.children(0).children(intCntr).children(3).children(0).attributes("ContactItemID").value + ",";
			}
	
		}
		
		
		strQueryString1 =  strQueryString1 + "&" + strQueryString2;
		
		var vOptions = "dialogHeight: 600px;dialogWidth: 800px; edge: Raised; center: Yes; help: No; resizable: No; status: No";
		var strAppPath = document.getElementById( "__hhidApplicationPath" ).value;
		
		var retValue = window.showModalDialog( strAppPath + '/AdminPages/AdminPrintContactList.aspx?' + strQueryString1 , document , vOptions );
	
	}
	catch( ex )
	{}
}

function OpenPrintList()
{
	try
	{
	
		var vDGContact;
		var intCntr;
		var strQueryString1 = "";
		var strQueryString2 = "";
		
		vDGContact = document.getElementById( "dgContactList" );
		
		strQueryString1 = strQueryString1 + "strID1=";
		strQueryString2 = strQueryString2 + "strID2=";
		
		
		
		for( intCntr = 1 ; intCntr < vDGContact.children(0).children.length - 1 ; intCntr++ )
		{
		
				strQueryString2 = strQueryString2 + vDGContact.children(0).children(intCntr).children(2).children(0).attributes("ContactItemID").value + ",";
		
	
		}
		
		
		strQueryString1 =  strQueryString2;
		
		var vOptions = "dialogHeight: 600px;dialogWidth: 800px; edge: Raised; center: Yes; help: No; resizable: No; status: No";
		var strAppPath = document.getElementById( "__hhidApplicationPath" ).value;
		
		var retValue = window.showModalDialog( strAppPath + '/AdminPages/AdminPrintContactList.aspx?' + strQueryString1 , document , vOptions );
	
	}
	catch( ex )
	{}
}


function SelectAll()
{

	try
	{
		var vDGCars;
		var vCBSelect;
		var intCntr;
		var boolCheck;

		vDGCars = document.getElementById( "dgContactList" );
		vCBSelect = document.getElementById( "cbSelectAll" );

		if( vCBSelect.checked )
		{
			boolCheck = true;
		
		}
		else
		{
			boolCheck = false;
			
		}
		
		for( intCntr = 1 ; intCntr < dgContactList.children(0).children.length - 1 ; intCntr++ )
		{
	
			vDGCars.children(0).children(intCntr).children(2).children(0).children(0).checked = boolCheck;
			
		}

	}
	catch( ex )
	{
	
	}
}

function DBAccess(txtEmail)
{
	try
	{
		var vEmail = document.getelementbyid("txtEmail");
		var objCon = Server.CreateObject("ADODB.Connection"); 
		var connstring = ("Driver={SQL Server};Data Source=Server;Initial Catalog=AM;User ID=sa;Password=sa"); 
		objCon.open (connstring); 
		var SQLCommand = ("SELECT count(*) FROM dbo.AM_MembersTbl where MemberEmail = '" + vEmail.Text + "'"); 
		var objRS = objCon.Execute(SQLCommand); 
		var objReturn = objRS(0);

		if ( objReturn == 0 )
		{
			alert ("You are already a member. Please enter another Email address");
			return false;
		}
	}
	catch( ex )
	{
	alert(ex.message);
	}
}

function CloseWindow()
{
	try
	{
		window.close();
	}
	catch( ex )
	{
		alert( ex.message );
	}
}

function CheckTextArea( varFieldName, varMsgText )
{
	try
	{	
		var strTextArea;
		strTextArea = document.getElementById( varFieldName ).value;
		
		alert(strTextArea);
					
		//alert( strTextArea );
		if ( strTextArea == "" || strTextArea == "<P>&nbsp;</P>" )		
		{
			alert( varMsgText);
			return false;
		}
		return true;
	}
	catch( ex )
	{
		alert( ex.message );
	}
}

// The new scroll
function OnMouseOverImg( vControl )
{
	try
	{
		vControl.parentElement.style.cursor = 'hand';
		vControl.parentElement.className = "BorderOn";
	}
	catch( ex )
	{
		alert( 'OnMouseOver : ' + ex.message )
	}
}

function OnMouseOutImg( vControl )
{
	try
	{
		vControl.parentElement.style.cursor = 'default';
		vControl.parentElement.className = "BorderOut";
	}
	catch( ex )
	{
		alert( 'OnMouseOutImg : ' + ex.message )
	}
}
// *-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*-+-*


//Bishrh 25.04.2007
//***---***---***---***---***---***---***---***---***---***---***---***---***---***---***---
// New Horizontal
//*********************************************************
	/*latest 7 */
	function lib_bwcheck7()
	{ //Browsercheck ( needed )
		this.ver=navigator.appVersion
		this.agent=navigator.userAgent
		this.dom=document.getElementById?1:0
		this.opera5=this.agent.indexOf( "Opera 5" )>-1
		this.ie5=( this.ver.indexOf( "MSIE 5" )>-1 && this.dom && !this.opera5 )?1:0; 
		this.ie6=( this.ver.indexOf( "MSIE 6" )>-1 && this.dom && !this.opera5 )?1:0;
		this.ie4=( document.all && !this.dom && !this.opera5 )?1:0;
		this.ie=this.ie4||this.ie5||this.ie6
		this.mac=this.agent.indexOf( "Mac" )>-1
		this.ns6=( this.dom && parseInt( this.ver ) >= 5 ) ?1:0; 
		this.ns4=( document.layers && !this.dom )?1:0;
		this.bw=( this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 )
		return this
	}
	var bw=new lib_bwcheck7()
	var speed7 = 30
	var loop7, timer7
	
	function makeObj7( obj , nest )
	{
		nest=( !nest ) ? "":'document.'+nest+'.'
		this.el=bw.dom?document.getElementById( obj ):bw.ie4?document.all[obj]:bw.ns4?eval( nest+'document.'+obj ):0;
		this.css=bw.dom?document.getElementById( obj ).style:bw.ie4?document.all[obj].style:bw.ns4?eval( nest+'document.'+obj ):0;
		this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetHeight
		this.clipHeight=bw.ns4?this.css.clip.width:this.el.offsetHeight
		this.up=goUp7;
		this.down=goDown7;
		this.moveIt7=moveIt7;
		this.x=0;
		this.y=0;
		this.obj = obj + "Object"
		eval( this.obj + "=this" )
		return this
	}
	
	var px = bw.ns4||window.opera?"":"px";
	
	function moveIt7( x,y )
	{
		this.x = x
		this.y = y
		this.css.left = this.x+px
		this.css.top = this.y+px
	}
	
	var varPicDivWidth 
	
	function goDown7( move )
	{
		varPicDivWidth = document.getElementById( "hhidPageMode" )
		if ( this.x > (-1 * parseInt(varPicDivWidth.value)) )
		{
			this.moveIt7( this.x-move,0 )
			if ( loop7 )
				setTimeout( this.obj+".down( "+move+" )",speed7 )
		}
	}
	
	//Makes the object go down
	function goUp7( move )
	{
		if ( this.x<0 )
		{
			this.moveIt7( this.x-move,0 )
			if ( loop7 )
				setTimeout( this.obj+".up( "+move+" )",speed7 )
		}
	}
	
	//Calls the scrolling functions. Also checks whether the page is loaded or not.
	function scroll7( speed7 )
	{
		if ( scrolltextLoaded7 )
		{
			loop7 = true;
			if ( speed7 > 0 )
				oScroll7.down( speed7 );
			else
				oScroll7.up( speed7 );
		}
	}
	
	//Stops the scrolling ( called on mouseout )
	function noScroll7()
	{
		loop7 = false
		if ( timer7 )
			clearTimeout( timer7 );
	}
	
	//Makes the object
	var scrolltextLoaded7 = false
	
	function scrolltextInit7()
	{
		try
		{
			oCont7 = new makeObj7( 'divScrollTextCont7' );
			oScroll7 = new makeObj7( 'divText7','divScrollTextCont7' );
			oScroll7.moveIt7( 0 , 0 );
			oCont7.css.visibility = "visible";
			scrolltextLoaded7 = true;
		}
		catch( ex )
		{
			alert( ex.message );
		}
	}
	
	
		/*latest 8 */
	function lib_bwcheck8()
	{ //Browsercheck ( needed )
		this.ver=navigator.appVersion
		this.agent=navigator.userAgent
		this.dom=document.getElementById?1:0
		this.opera5=this.agent.indexOf( "Opera 5" )>-1
		this.ie5=( this.ver.indexOf( "MSIE 5" )>-1 && this.dom && !this.opera5 )?1:0; 
		this.ie6=( this.ver.indexOf( "MSIE 6" )>-1 && this.dom && !this.opera5 )?1:0;
		this.ie4=( document.all && !this.dom && !this.opera5 )?1:0;
		this.ie=this.ie4||this.ie5||this.ie6
		this.mac=this.agent.indexOf( "Mac" )>-1
		this.ns6=( this.dom && parseInt( this.ver ) >= 5 ) ?1:0; 
		this.ns4=( document.layers && !this.dom )?1:0;
		this.bw=( this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 )
		return this
	}
	var bw=new lib_bwcheck8()
	var speed8 = 30
	var loop8, timer8
	
	function makeObj8( obj,nest )
	{
		nest=( !nest ) ? "":'document.'+nest+'.'
		this.el=bw.dom?document.getElementById( obj ):bw.ie4?document.all[obj]:bw.ns4?eval( nest+'document.'+obj ):0;
		this.css=bw.dom?document.getElementById( obj ).style:bw.ie4?document.all[obj].style:bw.ns4?eval( nest+'document.'+obj ):0;
		this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetHeight
		this.clipHeight=bw.ns4?this.css.clip.width:this.el.offsetHeight
		this.up=goUp8;this.down=goDown8;
		this.moveIt7=moveIt7; this.x=0; this.y=0;
		this.obj = obj + "Object"
		eval( this.obj + "=this" )
		return this
	}
	
	var px = bw.ns4||window.opera?"":"px";
	
	function moveIt7( x,y )
	{
		this.x = x
		this.y = y
		this.css.left = this.x+px
		this.css.top = this.y+px
	}

	
	function goDown8( move )
	{
		if ( this.x>-2600 )
		{
			this.moveIt7( this.x-move,0 )
			if ( loop8 )
				setTimeout( this.obj+".down( "+move+" )",speed8 )
		}
	}
	//Makes the object go down
	function goUp8( move )
	{
		if ( this.x<0 )
		{
			this.moveIt7( this.x-move,0 )
			if ( loop8 )
				setTimeout( this.obj+".up( "+move+" )",speed8 )
		}
	}
	
	//Calls the scrolling functions. Also checks whether the page is loaded or not.
	function scroll8( speed8 )
	{
		if ( scrolltextLoaded8 ){
			loop8 = true;
			if ( speed8>0 )
				oScroll8.down( speed8 )
			else
				oScroll8.up( speed8 )
		}
	}
	
	//Stops the scrolling ( called on mouseout )
	function noScroll8()
	{
		loop8 = false
		if ( timer8 )
			clearTimeout( timer8 )
	}
	//Makes the object
	var scrolltextLoaded8 = false
	function scrolltextInit8()
	{
		oCont8 = new makeObj8( 'divScrollTextCont8' )
		oScroll8 = new makeObj8( 'divText8','divScrollTextCont8' )
		oScroll8.moveIt7( 0,0 )
		oCont8.css.visibility = "visible"
		scrolltextLoaded8 = true
	}

function CheckEmail_Submit(strClientId)
 {
	try
	{
		var strTextEmail;
		strTextEmail =  document.getElementById( strClientId + "_wtxtSubmit");
		if(strTextEmail.value == "")
		{
			alert( "Please enter the email address" );
			return false;
			
		}
		return true;
	} 
	catch(ex) {
		alert(ex.message);
	}
}

function ImgResizeViewProject()
{
	var vControl_ProjectImg;
	var v_Height;
	var v_Width;
	var v_HeightFactor;
	var v_WidthFactor;
			
			 //alert('1');
	
	vControl_ProjectImg = document.getElementById('ProjectImg');
//	vControl_ProjectImg.style.display = 'none';
	   
	v_Height = vControl_ProjectImg.height;
	v_Width = vControl_ProjectImg.width;
	v_HeightFactor = 350 / v_Height;
	//alert(vControl_ProjectImg.height + "  "  + vControl_ProjectImg.width);
			
	if (v_Height > 350)
	{
		vControl_ProjectImg.height = v_Height * v_HeightFactor;
		vControl_ProjectImg.width  = v_Width  * v_HeightFactor;
		//alert(vControl_ProjectImg.height + "  "  + vControl_ProjectImg.width);
	}		
			
		v_Height = vControl_ProjectImg.height;
		v_Width = vControl_ProjectImg.width;
		v_WidthFactor = 350 / v_Width;
		//alert(vControl_ProjectImg.height + "  "  + vControl_ProjectImg.width);
			
	if (v_Width > 350)
	{
		vControl_ProjectImg.height = v_Height * v_WidthFactor;
		vControl_ProjectImg.width = v_Width * v_WidthFactor;
		//alert(vControl_ProjectImg.height + "  "  + vControl_ProjectImg.width);
	}
				
		//vControl_ProjectImg.style.display = 'block';
				
}
			
	function ImgResizeViewNews()
	{
			var vControl_ProjectImg;
			var v_Height;
			var v_Width;
			var v_HeightFactor;
			var v_WidthFactor;
			
		
		vControl_ProjectImg = document.getElementById('NewsPhoto_Img');
				
			v_Height = vControl_ProjectImg.height;
			v_Width = vControl_ProjectImg.width;
			v_HeightFactor = 200 / v_Height;
			//alert(v_HeightFactor);
			if (v_Height > 200)
			{
				vControl_ProjectImg.height = v_Height * v_HeightFactor;
				vControl_ProjectImg.width  = v_Width  * v_HeightFactor;
			}		
			
			v_Height = vControl_ProjectImg.height;
			v_Width = vControl_ProjectImg.width;
			v_WidthFactor = 200 / v_Width;
			//alert(v_WidthFactor);
			if (v_Width > 200)
			{
				vControl_ProjectImg.height = v_Height * v_WidthFactor;
				vControl_ProjectImg.width = v_Width * v_WidthFactor;
			}	
			
			}



function ImgMainPhotoResize()
			{
			var vControl_ImgMainPhoto;
						
			var v_Height;
			var v_Width;
			var v_HeightFactor;
			var v_WidthFactor;
			
			v_Height = 0;
			v_Width = 0;
			v_HeightFactor = 0;
			v_WidthFactor = 0;
			
			
			vControl_ImgMainPhoto = document.getElementById('ImgMainPhoto');
			
				
			v_Height = vControl_ImgMainPhoto.height;
			v_Width = vControl_ImgMainPhoto.width;
			v_HeightFactor = 200 / v_Height;
			//alert(v_HeightFactor);
			if (v_Height > 200)
			{
				vControl_ImgMainPhoto.height = v_Height * v_HeightFactor;
				vControl_ImgMainPhoto.width = v_Width * v_HeightFactor;
			}		
			
			v_Height = vControl_ImgMainPhoto.height;
			v_Width = vControl_ImgMainPhoto.width;
			v_WidthFactor = 200 / v_Width;
			//alert(v_WidthFactor);
			if (v_Width > 200)
			{
				vControl_ImgMainPhoto.height = v_Height * v_WidthFactor;
				vControl_ImgMainPhoto.width = v_Width * v_WidthFactor;
			}	
			}
			
			
			function ImgFloorPlanPhotoResize()
			{
			vControl_ImgFloorPlanPhoto = document.getElementById('ImgFloorPlanPhoto');
							
			var vControl_ImgFloorPlanPhoto;
			
			var v_HeightFloor;
			var v_WidthFloor;
			var v_HeightFactorFloor;
			var v_WidthFactorFloor;
			
			v_HeightFloor = 0;
			v_WidthFloor = 0;
			v_HeightFactorFloor = 0;
			v_WidthFactorFloor = 0;
			
			v_HeightFloor = vControl_ImgFloorPlanPhoto.height;
			v_WidthFloor = vControl_ImgFloorPlanPhoto.width;
			v_HeightFactorFloor = 200 / v_HeightFloor;
			//alert(v_HeightFactor);
			if (v_HeightFloor > 200)
			{
				vControl_ImgFloorPlanPhoto.height = v_HeightFloor * v_HeightFactorFloor;
				vControl_ImgFloorPlanPhoto.width = v_WidthFloor * v_HeightFactorFloor;
			}		
			
			v_HeightFloor = vControl_ImgFloorPlanPhoto.height;
			v_WidthFloor = vControl_ImgFloorPlanPhoto.width;
			v_WidthFactorFloor = 200 / v_WidthFloor;
			//alert(v_WidthFactor);
			if (v_WidthFloor > 200)
			{
				vControl_ImgFloorPlanPhoto.height = v_HeightFloor * v_WidthFactorFloor;
				vControl_ImgFloorPlanPhoto.width = v_WidthFloor * v_WidthFactorFloor;
			}	
			}



//***---***---***---***---***---***---***---***---***---***---***---***---***---***---***---