﻿// JScript File
function ShowHide(id,textid){
if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "";
			
			if(document.getElementById(textid) != null)
				document.getElementById(textid).value="Chichester - Terrace View";
			
				
	} else {
        	document.getElementById(id).style.display = "none";
        	if(document.getElementById(textid) != null)
        		document.getElementById(textid).value="";
	}

	//alert(document.getElementById('imgShowHide').src);
	
}
/*===================================Show hide data grid===================================*/
function ShowHideData(id){
var flag=false;

if(id=='detail1')
		if(document.getElementById('imgShowHide')!=null)
		{
			flag=true;
		}
	
	if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "";
			if(flag==true)
				document.getElementById('imgShowHide').src="images/icons/ico_hide_details.gif";
				document.getElementById('imgShowHide').alt="Hide Details";
				
	} else {
        	document.getElementById(id).style.display = "none";
        	if(flag==true)
        		document.getElementById('imgShowHide').src="images/icons/ico_show_details.gif";
        		document.getElementById('imgShowHide').alt="Show Details";
	}
	
	//alert(document.getElementById('imgShowHide').src);
	
}
/*====================================== Approve =====================================*/
function approvePrint(){
if(document.getElementById('cb3').checked == true)
{
document.getElementById('print1').style.display="";
}
else{
document.getElementById('print1').style.display="none";
}

if(document.getElementById('cb4').checked == true)
{
document.getElementById('print2').style.display="";
}
else{
document.getElementById('print2').style.display="none";
}
if(document.getElementById('cb5').checked == true)
{
document.getElementById('print3').style.display="";
}
else{
document.getElementById('print3').style.display="none";
}
}
//======================================Trim==============================================


/*=======================================Image Change================================*/

		function showhide_new(shimg)
		{
			//alert(document.getElementById(shimg).src);
			if(document.getElementById(shimg).alt == "1")
			{
				//alert('ho');
				document.getElementById(shimg).src = "images/icons/ico_decending.gif"; 
				document.getElementById(shimg).alt = "2";
				document.getElementById(shimg).title = "Descending";
				return;
			}
			else 
			{
				//alert('hi');
				document.getElementById(shimg).src = "images/icons/ico_accending.gif";
				document.getElementById(shimg).alt = "1";
				document.getElementById(shimg).title = "Ascending";
			}
		}
/*=======================================Open Window================================*/
function OpenWindow(pURL)
{					
	//closeWin.Click();	
	var NewX = window.screen.availWidth;
	var NewY = window.screen.availHeight;
	var CurWidth=1000;
	var CurHeight=window.screen.availHeight-100;
	var CurX = (NewX-CurWidth)/2;
	var CurY = (NewY-CurHeight)/2;
	new_window1=window.open(pURL,"newWin","toolbar=no, resizable=yes, directories=no, menubar=no, scrollbars=yes, width="+CurWidth+", height="+CurHeight+", Left="+CurX+", Top="+CurY+"");				
	new_window1.focus();						
}
function OpenPreviewWindow(pURL)
{					
	//closeWin.Click();	
	var NewX = window.screen.availWidth;
	var NewY = window.screen.availHeight;
	var CurWidth=795;
	var CurHeight=window.screen.availHeight-300;
	var CurX = (NewX-CurWidth)/2;
	var CurY = (NewY-CurHeight)/2;
	new_window1=window.open(pURL,"AppWIN2","toolbar=no, resizable=yes, directories=no, menubar=no, scrollbars=yes, width="+CurWidth+", height="+CurHeight+", Left="+CurX+", Top="+CurY+"");				
	new_window1.focus();						
}
function OpenSizeWindow(pURL,Width,Height)
{					
	//closeWin.Click();	
	var NewX = window.screen.availWidth;
	var NewY = window.screen.availHeight;
	var CurWidth=Width +40;
	var CurHeight=Height+70;
	var CurX = (NewX-CurWidth)/2;
	var CurY = (NewY-CurHeight)/2;
	new_window1=window.open(pURL,"newWin","toolbar=no, resizable=no, directories=no, menubar=no, scrollbars=no, width="+CurWidth+", height="+CurHeight+", Left="+CurX+", Top="+CurY+"");				
	new_window1.focus();						
}
/*====================================Swap Image========================================*/
window.resizeBy(0,0);

function image( i )  {
	document.images['big'].src=i;
}
function mapview( v ) {
	if ( document.getElementById )	{
		elm = document.getElementById("map");
	  elm.style.visibility = ( v ) ? "visible" : "hidden";
		return;
	}
	var mWnd;
	if ( document.layers ) {
  	mWnd = document.map_s;
 	}
	if ( document.all ) {
		mWnd = map_s.style;
	}
	mWnd.visibility = ( v ) ? "visible" : "hidden";
}
/*====================================slider selector=====================================*/
function showDiv(obj)
		{
			
			return overlib('123',WIDTH,200,HEIGHT,50);
		}
/*====================================Focus=====================================*/
function inputBoxFocus(id)
		{
		if(document.getElementById(id).disabled == true)
			{

				document.getElementById(id).disabled = false;

			}
		else
			{

				document.getElementById(id).disabled = true;
				document.getElementById(id).value = "" ;

			}
}

/*====================================For invoking ActiveX from external script=====================================*/
function createInnerHtml(DivId, InnerHtml)
	{
		document.getElementById(DivId).innerHTML = InnerHtml;
	}
/*====================================For Find Out The Date Difference in mm/dd/yyyy format =====================================*/
	
function dateDiff(d1,d2) 

{

var date1=d1.split("/");
var date2=d2.split("/");
var month1;
var month2;
var day1;
var day2;
var year1;
var year2;

month1=date1[0];
month2=date2[0];
day1=date1[1];
day2=date2[1];
year1=date1[2];
year2=date2[2];

if(year1>year2)
{
	//alert("Year Prob");
	
	return false;
}
else if(year1==year2)
{
	if(month1>month2)
	{
		//alert("Month Prob");
		return false;
	}
	else if(month1==month2)
	{
		if(day1>day2)
		{	
			//alert("Day Prob");
			return false;
		}
	}
	else
	{
		
		var day4=parseInt(month1)*30+parseInt(day1);
		var day5=parseInt(month2)*30+parseInt(day2);
		
		if(day4 > day5)
		{	
			//alert("Month Day Prob");			
	
			return false;
		}
	}

}
else
{

	
}
	return true;
}
/*------------------------------------TRim--------------------------------------------*/
function ALLTrim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
	if(VALUE.charAt(iTemp) == w_space)
	{
	}
	else
	{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
	}
	iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE)
{
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function


	function fnPopulateMax(oMinCombo, oMaxCombo, intMaxVal)
	{
		oMaxCombo.innerHTML = "";
		var MaxOption = new Array(46);
		MaxOption[0] = new Option("No Maximum","0");
		MaxOption[1] = new Option("\u00A320,000","20000");
		MaxOption[2] = new Option("\u00A325,000","25000");
		MaxOption[3] = new Option("\u00A330,000","30000");
		MaxOption[4] = new Option("\u00A335,000","35000");
		MaxOption[5] = new Option("\u00A340,000","40000");
		MaxOption[6] = new Option("\u00A345,000","45000");		
		MaxOption[7] = new Option("\u00A350,000","50000");
		MaxOption[8] = new Option("\u00A360,000","60000");
		MaxOption[9] = new Option("\u00A370,000","70000");
		MaxOption[10] = new Option("\u00A380,000","80000");
		MaxOption[11] = new Option("\u00A390,000","90000");
		MaxOption[12] = new Option("\u00A3100,000","100000");
		MaxOption[13] = new Option("\u00A3110,000","110000");
		MaxOption[14] = new Option("\u00A3120,000","120000");
		MaxOption[15] = new Option("\u00A3130,000","130000");
		MaxOption[16] = new Option("\u00A3140,000","140000");
		MaxOption[17] = new Option("\u00A3150,000","150000");
		MaxOption[18] = new Option("\u00A3160,000","160000");
		MaxOption[19] = new Option("\u00A3170,000","170000");
		MaxOption[20] = new Option("\u00A3180,000","180000");
		MaxOption[21] = new Option("\u00A3180,000","180000");
		MaxOption[22] = new Option("\u00A3190,000","190000");
		MaxOption[23] = new Option("\u00A3200,000","200000");
		MaxOption[24] = new Option("\u00A3225,000","225000");
		MaxOption[25] = new Option("\u00A3250,000","250000");
		MaxOption[26] = new Option("\u00A3275,000","275000");
		MaxOption[27] = new Option("\u00A3300,000","300000");
		MaxOption[28] = new Option("\u00A3325,000","325000");
		MaxOption[29] = new Option("\u00A3350,000","350000");
		MaxOption[30] = new Option("\u00A3375,000","375000");		
		MaxOption[31] = new Option("\u00A3400,000","400000");
		MaxOption[32] = new Option("\u00A3425,000","425000");
		MaxOption[33] = new Option("\u00A3450,000","450000");
		MaxOption[34] = new Option("\u00A3475,000","475000");
		MaxOption[35] = new Option("\u00A3500,000","500000");
		MaxOption[36] = new Option("\u00A3550,000","550000");
		MaxOption[37] = new Option("\u00A3600,000","600000");
		MaxOption[38] = new Option("\u00A3650,000","650000");
		MaxOption[39] = new Option("\u00A3700,000","700000");
		MaxOption[40] = new Option("\u00A3800,000","800000");
		MaxOption[41] = new Option("\u00A3900,000","900000");
		MaxOption[42] = new Option("\u00A31,000,000","1000000");
		MaxOption[43] = new Option("\u00A31,500,000","1500000");
		MaxOption[44] = new Option("\u00A32,000,000","2000000");
		MaxOption[45] = new Option("\u00A33,000,000","3000000");
		MaxOption[45] = new Option("\u00A36,000,000","6000000");
		
		for(i=0; i<MaxOption.length; i++)
		{
			if( parseInt(MaxOption[i].value) > parseInt(oMinCombo[oMinCombo.selectedIndex].value) || parseInt(MaxOption[i].value)==0)
			{
				oMaxCombo.options[oMaxCombo.length] =  MaxOption[i];
				
				if(intMaxVal == parseInt(MaxOption[i].value))
				{
					oMaxCombo.options[oMaxCombo.length - 1].selected = true;
				}				
			}
		}
	}
	
	function fnSetMaxVal(oMaxCombo, oHidField)
	{
		
		oHidField.value = oMaxCombo[oMaxCombo.selectedIndex].value	
	}


