	function createCookie(name,value,days,hours) {
		//if (days>0) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000)+(hours*60*60*1000));
			var expires = "; expires="+date.toLocaleString();
		//}
		//	else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	function findObject(theObj, theDoc) {
	  var p, i, foundObj;

	  if(!theDoc) theDoc = document;
	  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
	  {
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	  }
	  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	  for (i=0; !foundObj && i < theDoc.forms.length; i++)
		foundObj = theDoc.forms[i][theObj];
	  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
		foundObj = findObj(theObj,theDoc.layers[i].document);
	  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

	  return foundObj;
	}

    //define functions for showing most viewed objects
    function asignCssClass(tab_name) {
		var e1 = findObject(tab_name);
		var e2 = null;
        if (tab_name == 'tab_today') {
            e2 = findObject('tab_last7days');
        } else {
            e2 = findObject('tab_today');
        }
		e1.className = 'most_viewed_tab';
        e2.className = 'most_viewed_tab not_selected';
    }
	
	function asignCssClassEv(tab_name) {
        var e1 = findObject(tab_name);
		var e2 = null;
        if (tab_name == 'tab_ultimele_adaugate') {
            e2 = findObject('tab_top_vizualizari');
        } else {
            e2 = findObject('tab_ultimele_adaugate');
        }
		e1.className = 'most_viewed_tab';
        e2.className = 'most_viewed_tab not_selected';
    }

    function mostViewedObjDisplay(objDispType, ajx_path){
        var dadiv = $("div_most_viewed_listing");
		dadiv.update("<img src='"+ _QBOX_WEB_ROOT +"/images/indicator.gif' />");
		
		new Ajax.Request(_QBOX_WEB_ROOT + ajx_path, {
			method: 'post',
			parameters: {
				obj_most_viewed_type: objDispType
			},
			onSuccess: mostViewedObjDisplayHandler
		});
	}
	function mostViewedObjDisplayHandler(transport) {
		var ldiv = $('div_most_viewed_listing');
		var ind = transport.responseText.indexOf( "+@+" );
		if (ind >= 0) {
			var jscode = transport.responseText.substr(0, ind);
			var jsrest = transport.responseText.substring(ind+3, transport.responseText.length);
			eval(jscode);
		} else {
			var jsrest = transport.responseText;
		}
		ldiv.update( jsrest );
	}

    function displayClientMenu(){
        var x = findObject('client_menu');
        x.style.visibility ='visible';
    }

    function hideClientMenu(){
        var x = findObject('client_menu');
        x.style.visibility ='hidden';
    }

    function toggleClientMenu(){
        var x = findObject('client_menu');
        if(x.style.visibility == 'hidden' || x.style.visibility == ''){
            x.style.visibility ='visible';
        }
        else{
            x.style.visibility='hidden';
        }


    }