/*
 ' CVBase JavaScript API Library 
 ' Job Posting Service
 ' 
 ' Versione 1.0
 ' 
 ' 
 ' Per informazioni contattare:
 ' CVBase AG -  Davide Morelli
 ' http://www.cvbase.com
*/	 



/**
 * @class cvbJobPost 
*
*/
  
cvbJobPost = function () {

	// ************************************************************************ 
	// PRIVATE VARIABLES AND FUNCTIONS 
	// ONLY PRIVELEGED METHODS MAY VIEW/EDIT/INVOKE 
	// *********************************************************************** 
	
	var that = this;
	var buf = ['<table class="cvb-sign" cellpadding="0" cellspacing="0">',
			'<tbody><tr>',
			'<td class="cvb-sign-text"><div class="cvb-sign-text">powered by</div></td>',
			'<td class="cvb-sign-text"><a class="cvb-sign-text" href="http://www.cvbase.com" target="_blank"><span>CVBase JobAd</span></a></td>',
			'</tr></tbody>',
			'</table>'].join('');		
			

	
	// ************************************************************************ 
	// PUBLIC PROPERTIES -- ANYONE MAY READ/WRITE 
	// ************************************************************************ 

	this.name = 'myClass'; // il nome di questa classe


	// ************************************************************************ 
	// PRIVILEGED METHODS 
	// MAY BE INVOKED PUBLICLY AND MAY ACCESS PRIVATE ITEMS 
	// MAY NOT BE CHANGED; MAY BE REPLACED WITH PUBLIC FLAVORS 
	// ************************************************************************ 
	
	/* pubblico gli eventi */
		
	// inizializza il componente 
	this.init = function (params) {
		this.name = params.ClassName;
	};
		
	// funzione di test
	this.test = function () {
		alert('Hello');
	};
	
	// ritorna il logo da visualizzare per l'utilizzo del Job Posting di CVBase
	this.getCvbSign = function (el) {
	    if (el) {
	        el.innerHTML = buf;
		}
	};	
		
}; // end cvbJobPost


addHeadEl = function (eltype, href, op) {
    if (op) {
	    var d;
	    if (eltype == "script") {
		    d = document.createElement("script");
		    d.type = "text/javascript";
		    d.src = href;
		}
	    else if (eltype == "css") {
		    d = document.createElement("link");
		    d.type = "text/css";
		    d.href = href;
		    d.rel = "stylesheet";
	    }
	    var e = document.getElementsByTagName("head")[0];
	    if (!e) {
		    e = document.body.parentNode.appendChild(document.createElement("head"));
	    }
	    e.appendChild(d);
    } 
    else {
        if (eltype == "script") {
            document.write("<script src=\"" + href + "\" type=\"text/javascript\"></script>");
         } else if (eltype == "css") {
            document.write("<link href=\"" + href + "\" type=\"text/css\" rel=\"stylesheet\"></link>");
         }
    }
};

addHeadEl("css", "http://cvbase.com/jslib/cvbase/cvbjobpost.css", false);