function GoToPage(path,action,ObjectId,SubId,TimeStamp,TypeId,TempCustID,EZQuotePrice)
{
	//path	: Determines the target folder path for index.aspx.
	//action: Determines the action to be performed.
	//ObjectId	: Determines the objectid being used.
	//if(path) document.frmMain.action = "/UltimatePlans/"  +  path + "/Index.aspx";
	
	if(path) 
	{
		var sLocalSubWeb = "";
		if(path.length>1)
		{
			if ( document.location.host == 'localhost') {
				sLocalSubWeb = "/UltimatePlans";
			}
		
			/*
			if(path.indexOf('Orders') != -1)
			{
				document.frmMain.action = "https://"+document.location.host+"/UltimatePlans/" + path + "/Index.aspx";
			}
			
			else
			{
				document.frmMain.action = "http://"+document.location.host+"/UltimatePlans/" + path + "/Index.aspx";
			}
			*/
			if(path.indexOf('Orders') != -1)
			{
				document.frmMain.action = "https://"+document.location.host + sLocalSubWeb + "/" + path + "/Index.aspx";
			}
			else if(action == "8029")
			{
				document.frmMain.action = "https://"+document.location.host + sLocalSubWeb + "/"  + path + "/Index.aspx";
			}
			else
			{
				document.frmMain.action = "http://"+document.location.host + sLocalSubWeb + "/"   + path + "/Index.aspx";
			}

		}
		else
		{
			document.frmMain.action = "http://"+document.location.host + sLocalSubWeb + "/Index.aspx";
		}
	}
	
	if (action)document.frmMain.m_txtAction.value =action;
	if(ObjectId)document.frmMain.m_txtObjectId.value=ObjectId;
	if(SubId)document.frmMain.m_txtSubId.value=SubId;
	if(TimeStamp)document.frmMain.m_txtTimeStamp.value=TimeStamp;
	if(TypeId)document.frmMain.m_txtTypeId.value=TypeId;
	if(TempCustID)document.frmMain.m_txtTempCustID.value=TempCustID;
	if(EZQuotePrice)document.frmMain.m_txtEZQuotePrice.value=EZQuotePrice;
	document.frmMain.submit();
}

function SetPageVars(path,action,ObjectId,SubId,TimeStamp,TypeId,TempCustID,EZQuotePrice)
{
	//path	: Determines the target folder path for index.aspx.
	//action: Determines the action to be performed.
	//ObjectId	: Determines the objectid being used.
	
	if(path) 
	{
		var sLocalSubWeb = "";
		if(path.length>1)
		{
			
			if ( document.location.host == 'localhost') {
				sLocalSubWeb = "/UltimatePlans";
			}
			
			/* if(path.indexOf('Orders') != -1)
			{
				document.frmMain.action = "https://"+document.location.host+"/UltimatePlans/" + path + "/Index.aspx";
			}
			 else
			{
				document.frmMain.action = "http://"+document.location.host+"/UltimatePlans/" + path + "/Index.aspx";
			}
			*/
			if(path.indexOf('Orders') != -1)
			{
				document.frmMain.action = "https://"+document.location.host + sLocalSubWeb + "/"  + path + "/Index.aspx";
			} else if(action == "8029")
			{
				document.frmMain.action = "https://"+document.location.host + sLocalSubWeb  + "/" + path + "/Index.aspx";
			}
			else
			{
				document.frmMain.action = "http://"+document.location.host + sLocalSubWeb + "/"  + path + "/Index.aspx";
			}
		}
		else
		{
			document.frmMain.action = "http://"+document.location.host + sLocalSubWeb + "/Index.aspx";
		}

		/*
		if(path.length>1)
			document.frmMain.action = "/UltimatePlans/" + path + "/Index.aspx";
		else
			document.frmMain.action = "/UltimatePlans/Index.aspx";
		*/
	}

	//if(path) document.frmMain.action = "/UltimatePlans/" + path + "/Index.aspx";
	if (action)document.frmMain.m_txtAction.value =action;
	if(ObjectId)document.frmMain.m_txtObjectId.value=ObjectId;
	if(SubId)document.frmMain.m_txtSubId.value=SubId;
	if(TimeStamp)document.frmMain.m_txtTimeStamp.value=TimeStamp;
	if(TypeId)document.frmMain.m_txtTypeId.value=TypeId;
	if(TempCustID)document.frmMain.m_txtTempCustID.value=TempCustID;
	if(EZQuotePrice)document.frmMain.m_txtEZQuotePrice.value=EZQuotePrice;
	return true;
}
function WarnEasyAddition(path,action,ObjectId,SubId,TimeStamp,TypeId,TempCustID,EZQuotePrice)
{
	var blnResult=false;
	var strMessage="You are about to purchase a second floor addition plan set. It can only be built with the first floor plan package " + SubId + ". Continue to the order page?"
	if (window.confirm(strMessage)) {
		blnResult=true;

		GoToPage(path,action,ObjectId,SubId,TimeStamp,TypeId,TempCustID,EZQuotePrice);
	}

	return blnResult;

}
function EasyAdditionPopup(BasePlanId)
{
	var blnResult=false;
	var strMessage="You are about to purchase a second floor addition plan set. It can only be built with the first floor plan package " + BasePlanId + ". Continue to the order page?"
	if (window.confirm(strMessage)) {
		blnResult=true;
	}

	return blnResult;

}


function NotImplemented()
{
	window.alert('Under Construction');
}

function CheckSelectOne(lstBox, errorMessage) {
	// lstBox determines the object of List Box.
	// errorMessage determines the message to be shown in case of error.
	if(lstBox.selectedIndex == 0) 
	{
		if(errorMessage)alert(errorMessage);
		return false;
	}
	else {
		return true;
	}
}


// Function for previewing an Image in Add mode
function AddImagePreview()
		{
			var objFleImage;
			objFleImage = document.getElementById('m_ctlAddHomeStyle_m_fleImage');
			var path = objFleImage.value;
			if(path!="")
			{
				var objImgStyle;
				objImgStyle = document.getElementById('m_ctlAddHomeStyle_m_ImgStyle');
				objImgStyle.src=path;
			}
		}


// Function for previewing an Image in Edit mode
function ViewImagePreview(FileID, ImageID)
		{
			var objFleImage;
			var objImgStyle;
			objFleImage = document.getElementById(FileID);
			var path = objFleImage.value;
			if(path!="")
			{
				objImgStyle = document.getElementById(ImageID);
				objImgStyle.src=path;
				//document.frmMain.m_txtSubId.value=path;
			}
			//else
			//{
			//	document.frmMain.m_txtSubId.value="1";
			//}
		}

function ClearHomeStyleControls()
		{
			var objtxtName;
			var objtxtDescription;
			
			objtxtName = document.getElementById('m_ctlAddHomeStyle_m_txtHomeStyleName');
			objtxtDescription = document.getElementById('m_ctlAddHomeStyle_m_txtHomeStyleDescription');
			
			objtxtName.innerText="";
			objtxtDescription.innerText="";
		}


function CheckCookie()
{
	alert(document.cookie);
	if(document.cookie == "")
	{
		alert('no');
		//document.frmMain.m_txtCookie.value = "1";
		//alert(document.frmMain.m_txtCookie.value);
		window.location.href('../SessionTimeOut.aspx');
	}
	else
	{
		alert('yes');
	}
}

// Function to open a new popup window.
function NewPopUpWindow(p_URL)
{
	window.open(p_URL,"UltimatePlansPopUpImage","height=170,width=245,top=100,left=100,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
}
//Function to Display the Enlarged Images
function NewPopUpWindowEnlarged(p_URL)
{
	var n_Window;
	var strHTML;
	//n_Window =window.open("","UltimatePlansPopUpImage","height=500,width=625,top=0,left=0,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
	//strHTML = "<IMG style='WIDTH:625px ; HEIGHT: 430px' src=" + p_URL + "><br><P align=center><A href='javascript:self.close();'><IMG src='../../../Images/icon_close.gif'></A></p>"
	//n_Window = window.open(p_URL,"UltimatePlansPopUpImage","height=500,width=625,top=0,left=0,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
	n_Window = window.open(p_URL,"UltimatePlansPopUpImage","width=665,top=0,left=0,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
	//strHTML = "<IMG style='WIDTH:625px ; HEIGHT: 430px' src=" + n_Window.document['URL'] + "><br><P align=center><A href='javascript:self.close();'><IMG src='../../../Images/icon_close.gif'></A></p>"
	strHTML = "<IMG style='WIDTH:665px' src=" + n_Window.document['URL'] + "><br><P align=center><A href='javascript:self.close();'><IMG src='../../../Images/icon_close.gif'></A></p>"
	n_Window.document.write(strHTML);
}

// Function to open a new window.
function NewWindow(p_URL)
{
	window.open(p_URL,"UltimatePlansNewWindow");
}

//Function to compare two dates.
function CompareDates(fromDate, toDate, fromDateText, toDateText)
{
	var dtFrom = document.getElementById(fromDate);
	var dtTo = document.getElementById(toDate);

	var dtFromDate = new Date(dtFrom.value);
	var dtToDate = new Date(dtTo.value);

	if(dtFromDate > dtToDate)
	{
		alert(fromDateText + ' is greater than ' + toDateText);
		return false;
	}
	else
	{
		return true;
	}
}

function PreventKeys(e) 
{ 
    var key = e.keyCode; 
    switch (key) 
   { 
             case 13:  // for ENTER key
				e.returnValue=false;
				e.cancel = true;
				return false; 
                break; 

   } 
   return true; 
} 

function popupHelp (popupTitle, popupBody) {

    ileft = (screen.width - 350) / 2;
    itop = (screen.height -350) /2;
    var popupHelpWindow= window.open ("", "PopupHelp","scrollbars=yes,width=350,height=350,top=" + itop + ",left=" + ileft );
    popupHelpWindow.document.write("<H1>" + popupTitle + "</H1><BR>" + popupBody + "<P align=Center><A href='javascript: self.close()'>Close this Window</A></P>");


    return false;

}

function NewPopUpWindowForContent(p_URL,p_Height,p_Width)
{
	window.open(p_URL, "ContentPopup", "height=" + p_Height + "," + "width=" + p_Width + "," + "top=200,left=200,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no")
	//window.open(p_URL, "ContentPopup", "height=" + p_Height + "," + "width=" + p_Width + "," + "top=300,left=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no")
	//window.open(p_URL,"Content Popup","height=" + p_Height + "," + "width=" + p_Width + "," + "top=300,left=300, status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no");
	
}

/*
-- ORIGINAL WORKING JAVASCRIPT ( WORKS ON INDIVIDUAL ASPX PAGE)
function GoToPage(path,action,id1)
{
	//path	: Determines the target folder path for index.aspx.
	//action: Determines the action to be performed.
	//id1	: Determines the objectid being used.
	//if(path) document.frmMain.action = "/UltimatePlans/"  +  path + "/Index.aspx";
	if(path) document.frmMain.action = "http://"+"<%=Request.UrlReferrer.Host%>"+"<%=Request.ApplicationPath%>"+"/" + path + "/Index.aspx";
	if (action)document.frmMain.m_txtAction.value =action;
	if(id1)document.frmMain.m_txtObjectId.value=id1;
	document.frmMain.submit();
}

function SetPageVars(path,action,id1)
{
	//path	: Determines the target folder path for index.aspx.
	//action: Determines the action to be performed.
	//id1	: Determines the objectid being used.
	//if(path) document.frmMain.action = "/UltimatePlans/"  +  path + "/Index.aspx";
	//window.alert("Aishwarya");
		if(path) document.frmMain.action = "http://"+"<%=Request.UrlReferrer.Host%>"+"<%=Request.ApplicationPath%>"+"/" + path + "/Index.aspx";
		if (action)document.frmMain.m_txtAction.value =action;
		if(id1)document.frmMain.m_txtObjectId.value=id1;
		return true;
}
*/