var gResponsePlaceId = '';

function createSeoName(name, responsePlaceId)
{		
		this.gResponsePlaceId = responsePlaceId;
		
		var Ajax = new AjaxRequest(); 		
		
		if( Ajax.mRequest )
		{			
			Ajax.addEventListener( REQ_COMPLETE, requestResponse );

			Ajax.mRequest.open( "POST", "/ajax/createSeoName.php?name="+name , true);
			
			Ajax.mRequest.send( '1' );					
		}
	
}

function getCategoryItems(categoryId, responseTypeWanted)
{
		var Ajax = new AjaxRequest(); 		
		
		if( Ajax.mRequest )
		{			
			Ajax.addEventListener( REQ_COMPLETE, requestedCategoryItems );

			Ajax.mRequest.open( "POST", "/ajax/getCategoryItems.php?categoryId="+categoryId+"&responseTypeWanted="+responseTypeWanted , true);
			
			Ajax.mRequest.send( '1' );					
		}
}


function getDepartmentCategories(departmentId, itemId, responsePlaceId)
{
		this.gResponsePlaceId = responsePlaceId;
		
		var Ajax = new AjaxRequest(); 		
		
		if( Ajax.mRequest )
		{			
			Ajax.addEventListener( REQ_COMPLETE, requestResponse );

			Ajax.mRequest.open( "POST", "/ajax/getDepartmentCategories.php?departmentId="+departmentId+"&itemId="+itemId+"&responseType="+responsePlaceId , true);
			
			Ajax.mRequest.send( '1' );					
		}
}


function requestedCategoryItems(pAjax) 
{	
		if( pAjax.mRequest.status == 200 )
		{
			var message = pAjax.mRequest.responseText;

			document.getElementById( 'categoryItems' ).innerHTML = message;	
		} 	
		else
		{
			document.getElementById( 'categoryItems' ).innerHTML = 'Response failed!';
		}
}     


function valueCheck(value, valueName, responsePlaceId)
{		
		this.gResponsePlaceId = responsePlaceId;
		
		var Ajax = new AjaxRequest(); 		
		
		if( Ajax.mRequest )
		{			
			Ajax.addEventListener( REQ_COMPLETE, requestResponse );

			Ajax.mRequest.open( "POST", "/ajax/valueCheck.php?value="+value+"&valueName="+valueName , true);
			
			Ajax.mRequest.send( '1' );					
		}
	
}

function valueCheckEdit(value, valueName, responsePlaceId, columnName, columnValue)
{		
		this.gResponsePlaceId = responsePlaceId;
		
		var Ajax = new AjaxRequest(); 		
		
		if( Ajax.mRequest )
		{			
			Ajax.addEventListener( REQ_COMPLETE, requestResponse );

			Ajax.mRequest.open( "POST", "/ajax/valueCheck.php?value="+value+"&valueName="+valueName+"&columnName="+columnName+"&columnValue="+columnValue , true);
			
			Ajax.mRequest.send( '1' );					
		}
	
}

function requestResponse(pAjax) 
{	
		
		if( pAjax.mRequest.status == 200 )
		{
			var message = pAjax.mRequest.responseText;

			document.getElementById( gResponsePlaceId ).innerHTML = message;	
		} 	
		else
		{
			document.getElementById( gResponsePlaceId ).innerHTML = 'Response failed!';
		}
}     
