/*

 * Copyright 2002-2006 Jahia Ltd

 *

 * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL), 

 * Version 1.0 (the "License"), or (at your option) any later version; you may 

 * not use this file except in compliance with the License. You should have 

 * received a copy of the License along with this program; if not, you may obtain 

 * a copy of the License at 

 *

 *  http://www.jahia.org/license/

 *

 * Unless required by applicable law or agreed to in writing, software 

 * distributed under the License is distributed on an "AS IS" BASIS, 

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

 * See the License for the specific language governing permissions and 

 * limitations under the License.

 */

function quickOff(element) {

    element.style.color ="#323232";

    element.style.backgroundColor ="#ffffff";

}

function leftOff(element) {

    element.style.backgroundColor ="#F0F0F0";

}

function leftOn(element) {

    element.style.backgroundColor ="#C5C5C5";

}

function goTo(url) {

    document.location=url;

}



function swithToEditMode(){

     var theUrl = window.location.href;



     var pos = theUrl.indexOf("/op/edit");

     if (pos == -1) {

        pos = theUrl.indexOf("/op/");

        if ( pos == -1 ){

            pos = theUrl.indexOf("/pid/");

            if ( pos != -1 ){

                theUrl = theUrl.substring( 0, pos ) + "/op/edit" + theUrl.substring( pos );

            }

         } else {

            theUrl = theUrl.substring( 0, pos ) + "/op/edit/oldop/" + theUrl.substring( pos + 4 );

         }

         //alert(theUrl);

         window.location.href = theUrl;

    }

}



function resizeme(i) {

  if (i.width > 500) i.width=500;

}



function checkMaxPageItems(theForm){

	if ( document.searchpager && document.searchpager.maxPageItems

		&& document.searchpager.maxPageItems.selectedIndex != -1 ){

		theForm.maxPageItems.value = document.searchpager.maxPageItems.options[document.searchpager.maxPageItems.selectedIndex].value;

	}

}



function setFreeSearchInput(theForm){

	theForm.freeSearch.value=theForm.search.value;

}

