jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox()
}) 


function ajaxify_form(item, callbefore, callback){
    var item = $(item);
    // bind submit event
    item.bind("submit",function(e) {
        url = $(this).attr('action');
        callbefore();
        $.post(url,item.serialize(),callback, 'json');
        return false;
    });
}

function strstr( haystack, needle, bool ) {
    var pos = 0;
    haystack += '';
    pos = haystack.indexOf( needle );
    if( pos == -1 ){
        return false;
    } else{
        if( bool ){
            return haystack.substr( 0, pos );
        } else{
            return haystack.slice( pos );
        }
    }
}