window.none = function()
{
}

/**
 * File contains JS Library for Category Select Panel Control
 *
 * JavaScript  version 1
 * @category   JavaScript Libraries
 * @author     Eugene A. Kalosha <aristarch@zfort.net>
 * @copyright  (c) 2004-2006 by ZFort Group
 * @version    SVN: $Id: 206$
 * @link       http://www.zfort.net
 * @since      File available since Release 2.3.0
 */
if (typeof(PHP2Controls) == 'undefined') PHP2Controls = new Object();

    String.prototype.trim = function() {
        a = this.replace(/^\s+/, '');
        return a.replace(/\s+$/, '');
    };

    /**
     * PHP2Controls.CategorySelectPanel is the namespace and JS Class for Category Select control.
     *
     * @author   Eugene A. Kalosha <aristarch@zfort.net>
     * @version  $Id: categoryselectpanel.common.js, v 2.3.0 2006/09/19 $
     * @access   public
     * @package  php2
     */
    PHP2Controls.Testimonial = function(wsUrl, name, description, client, position, max, loadingScript)
    {
        /**
         * Category Select Panel Nesting Lavel
         *
         * @var  integer
         */
        this.wsUrl          = (wsUrl != null) ? wsUrl : '/wsdl/main.ajax.php';
        this.sRootUrl       = '/';
        this.position = 0;
        var currentObject   = this;

        this.eName        = name;
        this.eDescription = description;
        this.eClient      = client;
        this.ePosition      = position;
        this.max = max;

        this.loadingScript = loadingScript;
    }

    PHP2Controls.Testimonial.prototype.next = function()
    {
        var divMessage;
        var setRequest;

		++this.position;

		if (this.position > 0)
		{
		 document.getElementById('linkTstPrev').href = 'javascript: testimonial.prev();';
		}
		if (this.position > this.max)
		{
//		 document.getElementById('linkTstNext').href = 'javascript: window.none();';
		 this.position = 0;
		}

        this.serverResponse = new PHP2Ajax.JSONRequest(this.wsUrl);
        
        this.serverResponse.eName = this.eName;
        this.serverResponse.eDescription = this.eDescription;
        this.serverResponse.eClient = this.eClient;
		this.serverResponse.ePosition = this.ePosition;
        
        this.serverResponse.call('testimonialByPosition');
        this.serverResponse.add("current", this.position);
        this.serverResponse.setHandler(this.onNext);
        this.serverResponse.onResponseError = this.onResponseError;
        this.serverResponse.currentObject  = this;
        this.serverResponse.execute();

        this.showLoading();
    }

    PHP2Controls.Testimonial.prototype.prev = function()
    {
    	//if (this.position <= 0) return false;
    	
        var divMessage;
        var setRequest;

		--this.position;

		if (this.position < 0)
		{
		 //document.getElementById('linkTstPrev').href = 'javascript: window.none();';
		 this.position = this.max;
		}
		if (this.max > 0)
		{
		 document.getElementById('linkTstNext').href = 'javascript: testimonial.next();';
		}

        this.serverResponse = new PHP2Ajax.JSONRequest(this.wsUrl);
        
        this.serverResponse.eName = this.eName;
        this.serverResponse.eDescription = this.eDescription;
        this.serverResponse.eClient = this.eClient;
		this.serverResponse.ePosition = this.ePosition;

        this.serverResponse.call('testimonialByPosition');
        this.serverResponse.add("current", this.position);
        this.serverResponse.setHandler(this.onNext);
        this.serverResponse.onResponseError = this.onResponseError;
        this.serverResponse.currentObject  = this;
        this.serverResponse.execute();

        this.showLoading();
    }

    /**
     * Loads Responsed HTML Code to the
     *
     * @param AjaxRequest currentObject
     */
    PHP2Controls.Testimonial.prototype.onNext = function()
    {
        var countAnswer = this.response.Response;

		this.position = this.response.Response.position;
		//document.getElementById(this.eName).innerHTML        = this.response.Response.name;
		document.getElementById(this.eDescription).innerHTML = this.response.Response.description;
		document.getElementById(this.eClient).innerHTML      = this.response.Response.client;
		document.getElementById(this.ePosition).innerHTML      = this.response.Response.position;
		
		// this initialises the scollpanes on the page.
		$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 11});
		
        this.currentObject.hideLoading();
        return true;
    }

    /**
     * Set Skin Area Root Url
     *
     * @param string sRootUrl
     */
    PHP2Controls.Testimonial.prototype.setSRootUrl = function(sRootUrl)
    {
        this.sRootUrl = sRootUrl;
    }

    /**
     * On Response Error Method
     *
     */
    PHP2Controls.Testimonial.prototype.onResponseError = function()
    {
        this.currentObject.alert = new PHP2Controls.Alert("Error: " + this.response.Error.Code + ". " + this.response.Error.Message);
        this.currentObject.hideLoading();
    }

    /**
     * Show Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Testimonial.prototype.showLoading = function(divMessage)
    {
		var left;
		var top;
		var width  = document.getElementById('preloader').offsetWidth;
		var height = document.getElementById('preloader').offsetHeight;
		if (typeof window.pageXOffset != 'undefined' && typeof window.innerWidth != 'undefined')
		{
	        left = (window.innerWidth - width) / 2 + window.pageXOffset;
	        top  = (window.innerHeight - height) / 2 + window.pageYOffset;
	    }
	    else
	    {
	        left = (document.body.clientWidth - width) / 2 + document.documentElement.scrollLeft;
	        top  = (document.body.clientHeight - height) / 2 + document.documentElement.scrollTop;
	    }

		document.getElementById('preloader').style.margin = '0px';
		document.getElementById('preloader').style.padding = '0px';
//		document.getElementById('preloader').style.left = parseInt(left) + 'px';
		document.getElementById('preloader').style.top = parseInt(top) + 'px';
		document.getElementById('preloader').style.position = 'absolute';
		document.getElementById('preloader').style.display = 'block';		

    }

    /**
     * Hide Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Testimonial.prototype.hideLoading = function()
    {
		document.getElementById('preloader').style.display = 'none';
    }

    /**
     * Alert Error Message to browser
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Testimonial.prototype.alert = function(errorMessage, errorCode)
    {
        this.currentAlert = new PHP2Controls.Alert(errorMessage);
    }

    
    
    /// Vacancy
    
        /**
     * PHP2Controls.CategorySelectPanel is the namespace and JS Class for Category Select control.
     *
     * @author   Eugene A. Kalosha <aristarch@zfort.net>
     * @version  $Id: categoryselectpanel.common.js, v 2.3.0 2006/09/19 $
     * @access   public
     * @package  php2
     */
    PHP2Controls.Vacancy = function(wsUrl, icon, name, description, max, language, loadingScript)
    {
        /**
         * Category Select Panel Nesting Lavel
         *
         * @var  integer
         */
        this.wsUrl          = (wsUrl != null) ? wsUrl : '/wsdl/main.ajax.php';
        this.sRootUrl       = '/';
        this.position = 0;
        var currentObject   = this;

        this.eName        = name;
        this.eDescription = description;
        this.eIcon        = icon;
        this.language     = language;
        this.max = max;

        this.loadingScript = loadingScript;
    }

    PHP2Controls.Vacancy.prototype.next = function()
    {
        var divMessage;
        var setRequest;

		++this.position;

		if (this.position > 0)
		{
		 document.getElementById('linkVcPrev').href = 'javascript: vacancy.prev();'
		}
		if (this.position > this.max)
		{
		 //document.getElementById('linkVcNext').href = 'javascript: window.none();';
		 this.position = 0;
		}
		
        this.serverResponse = new PHP2Ajax.JSONRequest(this.wsUrl);
        
        this.serverResponse.eName = this.eName;
        this.serverResponse.eDescription = this.eDescription;
        this.serverResponse.eIcon = this.eIcon;
        
        this.serverResponse.call('vacancyByPosition');
        this.serverResponse.add("current", this.position);
        this.serverResponse.add("language", this.language);
        this.serverResponse.setHandler(this.onNext);
        this.serverResponse.onResponseError = this.onResponseError;
        this.serverResponse.currentObject  = this;
        this.serverResponse.execute();

        this.showLoading();
    }

    PHP2Controls.Vacancy.prototype.prev = function()
    {
    	//if (this.position <= 0) return false;
    	
        var divMessage;
        var setRequest;

		--this.position;

		if (this.position < 0)
		{
			//document.getElementById('linkVcPrev').href = 'javascript: window.none();';
			this.position = this.max;
		}
		if (this.max > 0)
		{
			document.getElementById('linkVcNext').href = 'javascript: vacancy.next();';
		}
		
        this.serverResponse = new PHP2Ajax.JSONRequest(this.wsUrl);
        
        this.serverResponse.eName = this.eName;
        this.serverResponse.eDescription = this.eDescription;
        this.serverResponse.eIcon = this.eIcon;

        this.serverResponse.call('vacancyByPosition');
        this.serverResponse.add("current", this.position);
        this.serverResponse.add("language", this.language);
        this.serverResponse.setHandler(this.onNext);
        this.serverResponse.onResponseError = this.onResponseError;
        this.serverResponse.currentObject  = this;
        this.serverResponse.execute();

        this.showLoading();
    }

    /**
     * Loads Responsed HTML Code to the
     *
     * @param AjaxRequest currentObject
     */
    PHP2Controls.Vacancy.prototype.onNext = function()
    {
        var countAnswer = this.response.Response;

		this.position = this.response.Response.position;
		document.getElementById(this.eName).innerHTML        = this.response.Response.name;
		document.getElementById(this.eDescription).innerHTML = this.response.Response.description;
//		document.getElementById(this.eIcon).src              = this.response.Response.icon;
		
        this.currentObject.hideLoading();
        return true;
    }

    /**
     * Set Skin Area Root Url
     *
     * @param string sRootUrl
     */
    PHP2Controls.Vacancy.prototype.setSRootUrl = function(sRootUrl)
    {
        this.sRootUrl = sRootUrl;
    }

    /**
     * On Response Error Method
     *
     */
    PHP2Controls.Vacancy.prototype.onResponseError = function()
    {
        this.currentObject.alert = new PHP2Controls.Alert("Error: " + this.response.Error.Code + ". " + this.response.Error.Message);
        this.currentObject.hideLoading();
    }

    /**
     * Show Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Vacancy.prototype.showLoading = function(divMessage)
    {
		var left;
		var top;
		var width  = document.getElementById('preloader').offsetWidth;
		var height = document.getElementById('preloader').offsetHeight;
		if (typeof window.pageXOffset != 'undefined' && typeof window.innerWidth != 'undefined')
		{
	        left = (window.innerWidth - width) / 2 + window.pageXOffset;
	        top  = (window.innerHeight - height) / 2 + window.pageYOffset;
	    }
	    else
	    {
	        left = (document.body.clientWidth - width) / 2 + document.documentElement.scrollLeft;
	        top  = (document.body.clientHeight - height) / 2 + document.documentElement.scrollTop;
	    }

		document.getElementById('preloader').style.left = left.toString() + 'px';
		document.getElementById('preloader').style.top = top.toString() + 'px';
		document.getElementById('preloader').style.position = 'absolute';
		document.getElementById('preloader').style.display = 'block';		
    }

    /**
     * Hide Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Vacancy.prototype.hideLoading = function()
    {
		document.getElementById('preloader').style.display = 'none';
    }

    /**
     * Alert Error Message to browser
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Vacancy.prototype.alert = function(errorMessage, errorCode)
    {
        this.currentAlert = new PHP2Controls.Alert(errorMessage);
    }



    /// Project
    
        /**
     * PHP2Controls.CategorySelectPanel is the namespace and JS Class for Category Select control.
     *
     * @author   Eugene A. Kalosha <aristarch@zfort.net>
     * @version  $Id: categoryselectpanel.common.js, v 2.3.0 2006/09/19 $
     * @access   public
     * @package  php2
     */
    PHP2Controls.Project = function(wsUrl, name, description, photo, navigator, max, language, loadingScript)
    {
        /**
         * Category Select Panel Nesting Lavel
         *
         * @var  integer
         */
        this.wsUrl          = (wsUrl != null) ? wsUrl : '/wsdl/main.ajax.php';
        this.sRootUrl       = '/';
        this.position = 0;
        var currentObject   = this;

        this.eName        = name;
        this.eDescription = description;
        this.ePhoto       = photo;
        this.eNavigator   = navigator;
        this.max = max;
        this.language     = language;

        this.loadingScript = loadingScript;
    }

    PHP2Controls.Project.prototype.setPage = function(page)
    {
        var divMessage;
        var setRequest;

		this.position = page;

		
        this.serverResponse = new PHP2Ajax.JSONRequest(this.wsUrl);
        
        this.serverResponse.eName = this.eName;
        this.serverResponse.eDescription = this.eDescription;
        this.serverResponse.ePhoto = this.ePhoto;
        this.serverResponse.eNavigator = this.eNavigator;
        
        this.serverResponse.call('projectByPosition');
        this.serverResponse.add("current", this.position);
		this.serverResponse.add("language", this.language);
        this.serverResponse.setHandler(this.onSetPage);
        this.serverResponse.onResponseError = this.onResponseError;
        this.serverResponse.currentObject  = this;
        this.serverResponse.execute();

        this.showLoading();
    }


    /**
     * Loads Responsed HTML Code to the
     *
     * @param AjaxRequest currentObject
     */
    PHP2Controls.Project.prototype.onSetPage = function()
    {
        var countAnswer = this.response.Response;

		this.position = this.response.Response.position;
		document.getElementById(this.eName).innerHTML        = this.response.Response.name;
		document.getElementById(this.eName).href             = this.response.Response.link;
		//document.getElementById(this.eDescription).innerHTML = this.response.Response.description;
		document.getElementById(this.ePhoto).src              = this.response.Response.photo;
		document.getElementById(this.eNavigator).innerHTML              = this.response.Response.navigator;		
		
		document.getElementById(this.ePhoto).onload = function(){
			PHP2Controls.Project.prototype.hideLoading();
		}
        
        
        return true;
    }

    /**
     * Set Skin Area Root Url
     *
     * @param string sRootUrl
     */
    PHP2Controls.Project.prototype.setSRootUrl = function(sRootUrl)
    {
        this.sRootUrl = sRootUrl;
    }

    /**
     * On Response Error Method
     *
     */
    PHP2Controls.Project.prototype.onResponseError = function()
    {
        this.currentObject.alert = new PHP2Controls.Alert("Error: " + this.response.Error.Code + ". " + this.response.Error.Message);
        this.currentObject.hideLoading();
    }

    /**
     * Show Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Project.prototype.showLoading = function(divMessage)
    {
		var left;
		var top;
		var width  = document.getElementById('preloader').offsetWidth;
		var height = document.getElementById('preloader').offsetHeight;
		if (typeof window.pageXOffset != 'undefined' && typeof window.innerWidth != 'undefined')
		{
	        left = (window.innerWidth - width) / 2 + window.pageXOffset;
	        top  = (window.innerHeight - height) / 2 + window.pageYOffset;
	    }
	    else
	    {
	        left = (document.body.clientWidth - width) / 2 + document.documentElement.scrollLeft;
	        top  = (document.body.clientHeight - height) / 2 + document.documentElement.scrollTop;
	    }

//		document.getElementById('preloader').style.left = left.toString() + 'px';
		document.getElementById('preloader').style.top = top.toString() + 'px';
		document.getElementById('preloader').style.position = 'absolute';
		document.getElementById('preloader').style.display = 'block';		
    }

    /**
     * Hide Loading Div element
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Project.prototype.hideLoading = function()
    {
		document.getElementById('preloader').style.display = 'none';
    }

    /**
     * Alert Error Message to browser
     *
     * @param  HTMLElement htmlObject
     */
    PHP2Controls.Project.prototype.alert = function(errorMessage, errorCode)
    {
        this.currentAlert = new PHP2Controls.Alert(errorMessage);
    }
    