﻿// genereal server response
function CServerResponse(mapdata, customresponse) {
	this.mapdata = mapdata;
	this.customresponse = customresponse;
}

// general mapdata
function CMapData(imageID, gifUrl, gifCaption, gifWidth, gifHeight, refDx, refDy, lowerX, lowerY, upperX, upperY, mppX, mppY, zoompercent, poiTypes, pois, visibleMarkers, selectedPin, shouldFitLowerX, shouldFitLowerY, shouldFitUpperX, shouldFitUpperY/*, iShouldDoFit*/)
{
	this.imageID = imageID;
	this.strGifUrl = gifUrl;
	this.strGifCaption = gifCaption;
	this.iMapWidth = gifWidth;
	this.iMapHeight = gifHeight;

	this.dCenterX = refDx;
	this.dCenterY = refDy;
	this.dViewMinX = lowerX;
	this.dViewMinY = lowerY;
	this.dViewMaxX = upperX;
	this.dViewMaxY = upperY;
	this.dShouldFitMinX = shouldFitLowerX;
	this.dShouldFitMinY = shouldFitLowerY;
	this.dShouldFitMaxX = shouldFitUpperX;
	this.dShouldFitMaxY = shouldFitUpperY;
	/*this.iShouldDoFit = iShouldDoFit;*/
	this.dMeterPerPixelX = mppX;
	this.dMeterPerPixelY = mppY;
	this.dZoomPercent = zoompercent;
	this.strPoiTypes = (poiTypes != undefined && poiTypes != null && poiTypes != "" ? poiTypes : "");
	this.arrPois = (pois != undefined && pois != null && pois != "" ? pois : new Array());
	this.visibleMarkers = (visibleMarkers != undefined && visibleMarkers != null && visibleMarkers != "" ? visibleMarkers : new Array());
	
	this.selectedPin = selectedPin;
}


// page initializers
function CLoginInitParams (sessionID, appID, langID, words, page, webprefix)
{
	this.m_sessionID = sessionID;
	this.m_appID =appID;
	this.m_langID = langID;
	this.m_words = words;
	this.m_page = page;
	this.m_webprefix = webprefix;
}

function CRegisterInitParams (sessionID, appID, langID, words, webprefix)
{
	this.m_sessionID = sessionID;
	this.m_appID =appID;
	this.m_langID = langID;				
	this.m_words = words;
	this.m_webprefix = webprefix;
}

function CChangeProfileInitParams (sessionID, appID, langID, words, userName, fullName, email, product, home, webprefix, userid)
{
	this.m_sessionID = sessionID;
	this.m_appID =appID;
	this.m_langID = langID;				
	this.m_words = words;
	this.m_userName = userName;
	this.m_fullName = fullName;
	this.m_email = email;
	this.m_product = product;
	this.m_home = home;
	this.m_webprefix = webprefix;
	this.m_userID = userid;
}

function CMapInitParams (sessionID, appID, langID, mapdata, bootaction, userID, username, userfullname, nAllMessages, selectedPoiIndex, userLevels, words, nreports, userproduct, countries, webprefix, poiTypes, pinStatuses, pinCategories)
{
	this.m_sessionID = sessionID;
	this.m_appID =appID;
	this.m_langID = langID;				
	this.m_words = words;
	this.m_mapdata = mapdata;
	this.m_bootAction = bootaction;
	this.m_userID = userID;
	this.m_userName = username;
	this.m_userRealName = userfullname;
	this.m_nAllMessages = nAllMessages;
	this.m_userProduct = userproduct;
	this.m_userLevels = CUserLevels(userLevels);
	this.m_nReports = nreports;
	this.m_selectedPoiIndex = selectedPoiIndex;
	this.m_countries = countries;
	this.m_webprefix = webprefix;
	this.m_poiTypes = poiTypes != undefined && poiTypes != null && poiTypes != "" ? poiTypes : new Array();
	this.m_pinStatuses = pinStatuses != undefined && pinStatuses != null && pinStatuses != "" ? pinStatuses : new Array();
	this.m_pinCategories = pinCategories != undefined && pinCategories != null && pinCategories != "" ? pinCategories : new Array();
}

function CManageReportsInitParams (sessionID, appID, langID, mapdata, bootaction, userID, username, userfullname, nAllMessages, selectedPoiIndex, userLevels, arrUserLevels, words, nreports, userproduct, countries, webprefix, poiTypes, pinStatuses, pinCategories)
{
	this.m_sessionID = sessionID;
	this.m_appID =appID;
	this.m_langID = langID;				
	this.m_words = words;
	this.m_mapdata = mapdata;
	this.m_bootAction = bootaction;
	this.m_userID = userID;
	this.m_userName = username;
	this.m_userRealName = userfullname;
	this.m_nAllMessages = nAllMessages;
	this.m_userProduct = userproduct;
	this.m_userLevels = CUserLevels(userLevels);
	this.m_arrUserLevels = arrUserLevels != undefined && arrUserLevels != null && arrUserLevels != "" ? arrUserLevels : new Array();
	this.m_nReports = nreports;
	this.m_selectedPoiIndex = selectedPoiIndex;
	this.m_countries = countries;
	this.m_webprefix = webprefix;
	this.m_poiTypes = poiTypes != undefined && poiTypes != null && poiTypes != "" ? poiTypes : new Array();
	this.m_pinStatuses = pinStatuses != undefined && pinStatuses != null && pinStatuses != "" ? pinStatuses : new Array();
	this.m_pinCategories = pinCategories != undefined && pinCategories != null && pinCategories != "" ? pinCategories : new Array();
}

function CManageUsersInitParams (sessionID, appID, langID, words, userID, username, userfullname, nAllMessages, userLevels, countries, webprefix)
{
	this.m_sessionID = sessionID;
	this.m_appID = appID;
	this.m_langID = langID;				
	this.m_words = words;
	this.m_userID = userID;
	this.m_userName = username;
	this.m_userRealName = userfullname;
	this.m_nAllMessages = nAllMessages;
	this.m_userLevels = CUserLevels(userLevels);
	this.m_webprefix = webprefix;
	this.m_countries = countries;
}

// ---------------------------------------------------------
// misc response structures

// available countries
function CCountry (appId, babelId, releaseInfo, releaseDate) {
	this.appId = appId;
	this.babelId = babelId;
	this.releaseInfo = releaseInfo;
	this.releaseDate = releaseDate;
}

// userlevels of a singel user
function CUserLevels (plevels) {
	var levels = new Array();

	if (plevels && plevels != "") {
		plevels = plevels.split("|");

		for (var i = 0; i < plevels.length; i++) {
			levels[plevels[i++]] = plevels[i];
		}
	}
	return levels;
}

// userdata of a single user
function CUserData (id, username, realname, email, product, levels, isDeleted, home) {
	this.id = id;
	this.username = username;
	this.realname = realname;
	this.email = email;
	this.product = product;
	this.levels = CUserLevels(levels);
	this.isDeleted = isDeleted;
	this.home = home;
}

// userdatas for some users
function CUserSearchResult(arrUserData, nTotal) {
	this.arrUserData = (arrUserData != null) ? arrUserData : new Array();
	this.nTotal = nTotal;
}

// available user level categories
function CArrUserLevelElem (id, babelid) {
	this.m_id = id;
	this.m_babelId = babelid;
}

// available poi types, subtypes, and extra attributes
function CBugtrackerPoiExtraAttr (id, parentId, babelID) {
	this.id = id;
	this.parentId = parentId;
	this.babelID = babelID;
}

function CBugtrackerPoiSubType (id, parentId, babelID, arrExtraAttr) {
	this.id = id;
	this.parentId = parentId;
	this.babelID = babelID;
	this.arrExtraAttr = (arrExtraAttr != null) ? arrExtraAttr : new Array();
}

function CBugtrackerPoiType (id, babelID, arrSubTypes) {
	this.id = id;
	this.babelID = babelID;
	this.arrSubTypes = (arrSubTypes != null) ? arrSubTypes : new Array();
}

// available pin statuses
function CBugtrackerStatus (id, babelID, strId) {
	this.id = id;
	this.babelID = babelID;
	this.strId = strId;
}

// available pin categories
function CPinCategory (id, strID, babelID)
{
	this.m_id = id;
	this.m_strID =strID;
	this.m_babelID = babelID;
}

// result for reports filtering: result, a record, a pi, and a message
function CSearchReportResult (records, nTotal) {
	this.records = (records != null ? records : new Array() );
	this.nTotal = nTotal;
}

function CSearchReportResultRecord (iKey, dX, dY, nTypeId, iImageId, arrNames, arrValues) {
	this.iKey = iKey;
	this.dX = dX;
	this.dY = dY;
	this.nTypeId = nTypeId;
	this.iImageId = iImageId;
	this.arrNames = (arrNames != null ? arrNames : new Array() );
	this.arrValues = (arrValues != null ? arrValues : new Array() );
}

function CPinDetails (messages, iID, iStatus, iTotal, description, category, x, y, downloadable) {
	this.messages = messages;
	this.iID = iID;
	this.iStatus = iStatus;
	this.iTotal = iTotal;
	this.description = unescape(description);
	this.category = category;
	this.x = x;
	this.y = y;
	this.downloadable = downloadable;
}

function CMessage (strTime, strUserName, strUserLevel, iNMessages, userID, strMessage, strFileNames, strStoreFileNames, strMimeTypes, strThumbnailUrls) {
	this.strTime = unescape(strTime);
	this.strUserName = unescape(strUserName);
	this.strUserLevel = unescape(strUserLevel);
	this.iNMessages = iNMessages;
	this.userID = userID;
	this.strMessage = unescape(strMessage);
	this.strFileNames = (strFileNames != null ? strFileNames : new Array() );
	this.strStoreFileNames = (strStoreFileNames != null ? strStoreFileNames : new Array() );
	this.strMimeTypes = (strMimeTypes != null ? strMimeTypes : new Array() );
	this.strThumbnailUrls = (strThumbnailUrls != null ? strThumbnailUrls : new Array() );
}

// NORC structure
function CNorc (lat, lon, id, angle)
{
	this.m_lat = lat;
	this.m_lon = lon;
	this.m_id = id;
	this.m_angle = angle;
}


// ---------------------------------------------------------
// Response functions


///---------------------------------------
/// private:
function MapLabel (id, x, y)
{
	this.ID = id;
	this.iPixX = x;
	this.iPixY = y;
}

/// public:
/// Terkepi koordinata
function CCoordinate(dX, dY)
{
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Poi-k nyilvantartasa: poi ID koordinataval
function CSimplePoi(strID, dX, dY)
{
	this.strID = strID;
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Szoveges cim koordinataval
function CSimpleAddress(strAddress, dX, dY)
{
	this.strAddress = strAddress;
	this.dX = dX;
	this.dY = dY;
}

/// public:
/// Kicsit bonyultabb cim
function CAddress(strAddress, dX, dY, dMinX, dMinY, dMaxX, dMaxY)
{
	this.strAddress = (strAddress != null ? strAddress : "");
	this.dX = (dX != null ? dX : 0);
	this.dY = (dY != null ? dY : 0);
	this.dMinX = (dMinX != null ? dMinX : 0);
	this.dMinY = (dMinY != null ? dMinY : 0);
	this.dMaxX = (dMaxX != null ? dMaxX : 0);
	this.dMaxY = (dMaxY != null ? dMaxY : 0);
}

/// public:
/// Meg bonyolultabb cim
function CComplexAddress(strAddress, dX, dY, dMinX, dMinY, dMaxX, dMaxY, strCountry, strRegion, strSettlement, strDistrict, strSubSettlement, strStreetName, strStreetType, strHouseNumber, strStreetName2, strStreetType2, strZip)
{
	this.strAddress = (strAddress != null ? strAddress : "");
	this.dX = (dX != null ? dX : 0);
	this.dY = (dY != null ? dY : 0);
	this.dMinX = (dMinX != null ? dMinX : 0);
	this.dMinY = (dMinY != null ? dMinY : 0);
	this.dMaxX = (dMaxX != null ? dMaxX : 0);
	this.dMaxY = (dMaxY != null ? dMaxY : 0);

	this.strCountry = (strCountry != null ? strCountry : ""); // orszag
	this.strRegion = (strRegion != null ? strRegion : ""); // megye
	this.strSettlement = (strSettlement != null ? strSettlement : ""); // telepules
	this.strDistrict = (strDistrict != null ? strDistrict : ""); // kerulet
	this.strSubSettlement = (strSubSettlement != null ? strSubSettlement : ""); // telepulesresz
	this.strStreetName = (strStreetName != null ? strStreetName : ""); // utcanev
	this.strStreetType = (strStreetType != null ? strStreetType : ""); // kozterulet tipus
	this.strHouseNumber = (strHouseNumber != null ? strHouseNumber : ""); // hazszam
	this.strStreetName2 = (strStreetName2 != null ? strStreetName2 : ""); // sarokcim utcanev
	this.strStreetType2 = (strStreetType2 != null ? strStreetType2 : ""); // sarokcim kozterulet tipus
	this.strZip = (strZip != null ? strZip : ""); // iranyitoszam

}

/// private:
function ClickablePoi(strID, iX, iY, strName, dX, dY)
{
	this.strID = (strID != undefined && strID != null ? strID : "");
	this.iX    = (iX != undefined ? iX : 0);
	this.iY    = (iY != undefined ? iY : 0); 
	this.strName = (strName != undefined && strName != null ? strName : "");	
	this.dX    = dX;
	this.dY    = dY;
}

/// public:
/// Poi tipust leiro struktura
/// A Poi tipusok egy tobbszintu faban vannak
function CPoiType(iID, strName, iLevel, iParentID)
{
	// Poi tipus ID-je (alt. pozitiv szam)
	this.iID = (iID != undefined && iID != null ? iID : 0);
	// Poi tipus neve
	this.strName = (strName != undefined && strName != null ? strName : "");
	// A poi tipus a fa melyik szintjen van
	this.iLevel = (iLevel != undefined && iLevel != null ? iLevel : 0);
	// A szulo tipus azonositoja
	this.iParentID = (iParentID != undefined && iParentID != null ? iParentID : 0);
}

// public:
// Egy poi rekordot leiro struktura
function CPoiRecord(nID, nTypeID, iImageID, arrNames, arrValues, dX, dY)
{
	// A rekord azonositoja
	this.nID = nID;
	// A tipus azonositoja (legszukebb ertelmu)
	this.nTypeID = nTypeID;
	// A rekordhoz tartozo kep azonositoja (jelenleg nem hasznalt)
	this.iImageID = iImageID;
	// Egy tombben a rekordhoz tartozo, ervenyes adatot tartalmazo mezonevek
	this.arrNames = (arrNames != null ? arrNames : new Array() );
	// Mezoertekek a fenti mezokhoz
	this.arrValues = (arrValues != null ? arrValues : new Array() );
	// A rekord wgs koordinataja
	this.dX = dX;
	this.dY = dY;
}

// public:
// Poi kereses parametereit tartalmazo osztaly
function CPoiQuery(nID, strFilter, strType, iFirst, iLast, bHasRect, dMinX, dMinY, dMaxX, dMaxY)
{
	// Keresett poi azonositoja (0, ha nem kell ID-re keresni)
	this.nID = (nID != undefined && nID != null ? nID: 0);
	// Reszsztring a keresett poi nevebol, vagy mas keresheto attributumabol (pl. webcim)
	this.strFilter = (strFilter != undefined && strFilter != null ? strFilter : "");
	// Reszsztring a keresett poi tipusabol
	this.strType = (strType != undefined && strType != null ? strType : "");
	// Hanyadik talalatol kezdve adja vissza
	this.iFirst = (iFirst != undefined && iFirst != null ? iFirst : 0);
	// Hanyadik talalatig adja vissza
	this.iLast = (iLast != undefined && iLast != null ? iLast : iFirst + 20);
	// Egy teglalapon belul keres (true), vagy a teljes adatbazisban
	this.bHasRect = (bHasRect ? true : false);
	// A teglalapos kereseshez a koordinatak
	this.dMinX = (dMinX != undefined && dMinX != null ? dMinX : 0.0);
	this.dMinY = (dMinY != undefined && dMinY != null ? dMinY : 0.0);
	this.dMaxX = (dMaxX != undefined && dMaxX != null ? dMaxX : 0.0);
	this.dMaxY = (dMaxY != undefined && dMaxY != null ? dMaxY : 0.0);
}

//public:
// Poi kereses eredmenye
function CPoiSearchResult(iFirst, bHasNextPage, arrRecords)
{
	this.iFirst = (iFirst != undefined && iFirst != null ? iFirst : 0);
	this.bHasNextPage = (bHasNextPage != undefined && bHasNextPage != null ? bHasNextPage : false);
	this.arrRecords = (arrRecords != null ? arrRecords : new Array() );
}

function CDrawMarker(id, iX, iY, className)
{
	this.id = id;
	this.iX = iX;
	this.iY = iY;
	this.className = className;
}

function CZoomPinResult (p_mapdata)
{
	this.mapdata = p_mapdata;
}



