var root_dir = (window.location.href.indexOf("192.168.0.202") != -1 ? "/Client/holiday" : "");
if (root_dir == '' && window.location.href.indexOf("localhost") != -1) {
  //root_dir = "/holiday";
}
if (root_dir == '' && window.location.href.indexOf("192.168.0.56") != -1) {
  //root_dir = "/holiday";
}
var browser, verStr = navigator.appVersion, app = navigator.appName, version = parseFloat(verStr);

function test_browser() {
  if ((app.indexOf('Netscape') != -1) && version >= 5) {
    browser = "netscape";
  }
  else if ((app.indexOf('Microsoft') != -1) && version >= 4) {
    browser = "ie";
  }
}

var body_content = new Array("bodycontent", "preloader");
test_browser();
function show_sub(show_which_sub, var_array, mode) {

  if (mode == "preloader") {
    for (i = 0; i < eval(var_array + ".length"); i++) {
      if (eval(var_array + "[i]") != show_which_sub) {
        hide_sub(eval(var_array + "[i]"), mode);
      }
    }
  }

  if (show_which_sub != "") {
    if (browser == "netscape") {
      if (document.getElementById(show_which_sub).style.display == 'block') {
        document.getElementById(show_which_sub).style.display = 'none';
      }
      else {
        document.getElementById(show_which_sub).style.display = 'block';
      }
    }
    else if (browser == "ie") {
      show_menu = eval(show_which_sub);
      if(show_menu.style.display == 'block'){
        show_menu.style.display = 'none';
      }
      else {
        show_menu.style.display = 'block';
      }
    }
  }

}

function hide_sub(which_sub, mode) {
  if (browser == "netscape") {
    document.getElementById(which_sub).style.display = 'none';
  }
  else if (browser == "ie") {
    sub_menu = eval(which_sub);
    sub_menu.style.display = 'none';
  }
}

function auto_hide() {
  show_sub("");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document;if(d.images){if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;if(!d) d=document;if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n];for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc) x.oSrc=x.src;x.src=a[i+2];}
}

function scroll_up() {
  current_pos = document.getElementById('scroll_clipper').scrollTop;
  document.getElementById('scroll_clipper').scrollTop = current_pos + 20;
}

function scroll_down() {
  current_pos = document.getElementById('scroll_clipper').scrollTop;
  document.getElementById('scroll_clipper').scrollTop = current_pos - 20;
}

function char_count(eid, maxlen, max_lines) {

  var inputstr;
  var strlen;
  var charleft;
  var numcr;
  var temp = new Array();

  if (document.getElementById(eid).value != "") {
    inputstr = document.getElementById(eid).value;
    strlen = inputstr.length;

    if (strlen > maxlen) {
      document.getElementById(eid).value = document.getElementById(eid).value.substring(0,maxlen);
      charleft = 0;
      alert("Exceeds maximum number of characters!");
    }
    else {
      charleft = maxlen - strlen;
    }

    document.getElementById('charleft' + eid).innerHTML = charleft + " / " + maxlen;

  }

  if (max_lines > 0) {

    var temp2 = document.getElementById(eid).value.split('\r\n');
    var temp_val = "";
    counter = 0;
    if (temp2.length > max_lines) {
      alert("Exceeds maximum number of lines!");
      for (i = 0; i < max_lines; i++) {
        temp_val = temp_val + temp2[i];
        if (i < (max_lines - 1)) {
          temp_val = temp_val + "\n";
        }
      }
      document.getElementById(eid).value = temp_val;
    }

  }

}

function row_over(row_id, row_color) {
  document.getElementById(row_id).style.backgroundColor = row_color;
}

function add_to_favorite(url, title) {
  if (window.sidebar) {
    window.sidebar.addPanel(title, url, "");
  }
  else if( window.external ) {
    window.external.AddFavorite(url, title);
  }
  else if (window.opera && window.print) {
    return true;
  }
}

function mdiv(menu_id) {

  ffile = "flash/mdiv.swf";
  mn_name = "MM" + menu_id;
  document.write("<span id='" + mn_name + "'></span>");

  var fmn = new SWFObject(ffile, "mn", "282", "5", "5", "#FFFFFF");
  fmn.addParam("wmode", "transparent");
  fmn.write(mn_name);

}

function mm(page_title, menu_id, level, page, submenu, quick_link) {

  ffile = "flash/m" + level + ".swf";
  mn_name = "MM" + menu_id;
  document.write("<span id='" + mn_name + "'></span>");

  var fmn = new SWFObject(ffile, "mn", "282", "35", "6", "#FFFFFF");
  fmn.addVariable("page_id",    menu_id);
  fmn.addVariable("page",       page);
  fmn.addVariable("page_title", page_title);
  fmn.addVariable("submenu",     submenu);
  fmn.addVariable("quick_link",     quick_link);
  fmn.addParam("wmode", "transparent");
  fmn.write(mn_name);

}

var w_width = w_height = 0;

function get_window_size() {
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
      w_width = window.innerWidth;
      w_height = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      w_width = document.body.offsetWidth;
      w_height = document.body.offsetHeight;
    }
  }
}

active_image = "";

function show_image(img_id, pic, pic_width, pic_height) {

  //get_window_size();

  hide_image();

  var so = new SWFObject("flash/pop.swf", "pop_up", 330, 255, "6", "#FFFFFF");
  so.addParam("wmode", "transparent");
  so.addVariable("pic", pic);
  so.addVariable("pic_width", pic_width);
  so.addVariable("pic_height", pic_height);
  so.write('big_pic');

  document.getElementById(img_id).style.display = "block";

  active_image = img_id;

}

function hide_image() {

  if (document.getElementById(active_image)) {
    document.getElementById(active_image).style.display = "none";
  }

}

function youtube(youtube_code) {

  url = "youtube_viewer.php?youtube=" + youtube_code;
  window.open(url,'browser','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=445,height=375')

}

var min = 8;
var max = 16;

function font_up() {

   var p = document.getElementsByTagName('body');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}

function font_down() {

   var p = document.getElementsByTagName('body');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }

}

function CreateBookmarkLink(title, url) {

  if (window.sidebar) { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
  }
  else if( window.external ) { // IE Favorite
    window.external.AddFavorite( url, title);}
    else if(window.opera && window.print) { // Opera Hotlist
      return true;
    }
  }

  if (window.external) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Add to Favorites</a>');
  }
  else  if (window.sidebar) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Bookmark Page</a>');
  }
  else if (window.opera && window.print) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Add Bookmark</a>');
}

function show_subscription_box() {
  document.getElementById('newsletter_subscription_box_1').style.display='block'
  document.getElementById('subs_name').focus();
}

var active_faq = "";

function show_faq (eid) {

  if (active_faq != "") {
    document.getElementById(active_faq).style.display = "none";
  }
  document.getElementById(eid).style.display = "block";
  active_faq = eid;

}

function refresh_calendar() {
  cyear  = document.getElementById('cyear').value;
  cmonth = document.getElementById('cmonth').value;
  window.location = "index.php?year=" + cyear + "&month=" + cmonth;
}

var event_req = "";

function get_event(date) {

  var query = "&date=" + date;
  var url   = "ajax/events.ajx.php";

  document.getElementById('selected_event').innerHTML = "Loading event...";

  tmp_http_req   = new init_post_request();
  event_req      = tmp_http_req.fn_request;

  event_req.onreadystatechange = show_event;

  post_request(event_req, url, query);

  return;

}

function show_event() {

  if (event_req.readyState == 4 || event_req.readyState == "complete") {
    data = event_req.responseText;
    document.getElementById('selected_event').innerHTML = data;
  }

}

var active_answer = "";

function show_answer(eid) {

  if (active_answer != "") {
    document.getElementById(active_answer).style.display = "none";
  }
  document.getElementById(eid).style.display = "block";
  active_answer = eid;

}

function update_team_details() {

  if (document.getElementById('team_name').value != "") {
    document.getElementById('new_team_details').style.display = "block";
  }
  else {
    document.getElementById('new_team_details').style.display = "none";
  }
  document.getElementById('new_team_name').value = document.getElementById('team_name').value;

}

function disable_rego_buttons() {
  var buttons = new Array("reset", "cmd", "cmd1", "cmd2", "cmd3");
  for (i = 0; i <= buttons.length; i++) {
    if (document.getElementById(buttons[i])) {
      document.getElementById(buttons[i]).disabled = true;
    }
  }
}

function alert_elite() {

  if (document.getElementById('category').value == 0 && document.getElementById('category').value != "") {
    alert("Qualifying time required: \n- Male: < 4:15\n- Female: < 4:45");
  }

}

function select_category (current) {

  dob_year = document.getElementById('dob_year').value;

  if (current - dob_year <= 14) {
    document.getElementById('category').value = 1;
  }
  else if (current - dob_year <= 17) {
    document.getElementById('category').value = 2;
  }
  else if (current - dob_year <= 34) {
    document.getElementById('category').value = 3;
  }
  else if (current - dob_year <= 49) {
    document.getElementById('category').value = 4;
  }
  else {
    document.getElementById('category').value = 5;
  }

}

function check_source() {
  document.getElementById('other_source').style.display = "none";
  if (document.getElementById('source').value == "Other") {
    document.getElementById('other_source').style.display = "block";
  }
}

function check_billing_address() {
  var fields = new Array("address_1", "address_2", "city", "state", "zip");
  if (document.getElementById('billing_address').value == "same") {
    for (i = 0; i < fields.length; i++) {
      document.getElementById('bill_' + fields[i]).value = document.getElementById(fields[i]).value;
    }
  }
}

function getViewportHeight() {
  if (window.innerHeight!=window.undefined) return window.innerHeight;
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
  if (document.body) return document.body.clientHeight;

  return window.undefined;
}

function getViewportWidth() {
  var offset = 16;
  var width = null;
  if (window.innerWidth!=window.undefined) return window.innerWidth + offset;
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth + offset;
  if (document.body) return document.body.clientWidth + offset;
}

function getScrollTop() {
  if (self.pageYOffset) // all except Explorer
  {
    return self.pageYOffset;
  }
  else if (document.documentElement && document.documentElement.scrollTop)
    // Explorer 6 Strict
  {
    return document.documentElement.scrollTop;
  }
  else if (document.body) // all other Explorers
  {
    return document.body.scrollTop;
  }
}

function getScrollLeft() {
  if (self.pageXOffset) // all except Explorer
  {
    return self.pageXOffset;
  }
  else if (document.documentElement && document.documentElement.scrollLeft)
    // Explorer 6 Strict
  {
    return document.documentElement.scrollLeft;
  }
  else if (document.body) // all other Explorers
  {
    return document.body.scrollLeft;
  }
}

var actively_displayed_div = "";

function center_div(which_div) {

  actively_displayed_div = which_div;
  document.getElementById(which_div).style.display = "block";

  newWidth  = document.getElementById(which_div).offsetWidth;
  newHeight = document.getElementById(which_div).offsetHeight;

  var theBody = document.getElementsByTagName("body")[0];
  var scTop = parseInt(getScrollTop(),10);
  var scLeft = parseInt(theBody.scrollLeft,10);
  var fullHeight = getViewportHeight();
  var fullWidth = getViewportWidth();
  var sc_left = getScrollLeft();

  document.getElementById(which_div).style.top     = (scTop + ((fullHeight - newHeight) / 2)) + "px";
  document.getElementById(which_div).style.left    = (scLeft + sc_left + ((fullWidth - newWidth) / 2)) + "px";

}

function re_center_div () {
  if (actively_displayed_div != "" && document.getElementById(actively_displayed_div).style.display == "block") {
    center_div(actively_displayed_div);
  }
}

function addevent(obj,evt,fn,capt){
  if(obj.addEventListener) {
    obj.addEventListener(evt, fn, capt);
    return true;
  }
  else if(obj.attachEvent) {
    obj.attachEvent('on'+evt, fn);
    return true;
  }
  else return false;
}

if (document.getElementById && document.getElementsByTagName) {
  addevent(window, 'load', re_center_div, false);
  addevent(window, 'resize', re_center_div, false);
  addevent(window, 'scroll', re_center_div, false);
}

function open_in_shadowbox (source, type, title) {
  Shadowbox.open({
    player:     type,
    title:      title,
    content:    source
  });
}

//Shadowbox.loadSkin('classic', root_dir + '/javascripts/skin');
//Shadowbox.loadLanguage('en', root_dir + '/javascripts/lang');
//Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], root_dir + '/javascripts/player');

function sb_init() {
  Shadowbox.init({
    // let's skip the automatic setup because we don't have any
    // properly configured link elements on the page
    skipSetup: true
   });
}


jQuery(document).ready(function() {
  window.alert = function(message, title) {
    if (title == null) title = "Alert";
    show_message_dialog(title, message.replace(/\n/g, "<br />"));
  };

  jQuery("a").click(function(event) {
    if (jQuery(this).attr("onclick") != undefined) {
      event.preventDefault();
    }
  });

});

function remove_listing(pid) {
  show_confirm_dialog('Confirmation', 'This will remove the property from your listing.<br /><br />Please click OK to confirm the removal.', function() {
    window.location = root_dir + '/members/property-wizard?action=remove&pid=' + pid;
  });
}

function show_confirm_dialog(title, message, ok_fn) {
  show_message_dialog(title, message, ok_fn, null, null, true);
}

var _prevent_close = false;
function show_message_dialog(title, message, ok_fn, prevent_close, auto_ok, cancel) {
  var auto_ok_timer = null;

  _prevent_close = prevent_close;
  if (title == null) title = "Info";

  if (title == "Alert") {
    jQuery("#dialog-message_icon").attr("class", "ui-icon ui-icon-alert");
    title = "Holiday Rentals Mauritius"
  } else {
    jQuery("#dialog-message_icon").attr("class", "ui-icon ui-icon-info");
  }

  if (message == null) message = "";
  jQuery("#dialog-message_msg").html(message);

  var buttons;

  if (cancel != null) {
    buttons = {
      Cancel: function() {
        jQuery(this).dialog('close');
      },
      OK: function() {
        if (ok_fn != null) ok_fn();
        clearTimeout(auto_ok_timer);
        auto_ok_timer = null;
        jQuery(this).dialog('close');
      }
    };
  } else {
    buttons = {
      Ok: function() {
        if (ok_fn != null) ok_fn();
        clearTimeout(auto_ok_timer);
        auto_ok_timer = null;
        jQuery(this).dialog('close');
      }
    };
  }

  jQuery("#dialog-message").dialog({
    modal: true,
    title: title,
    buttons: buttons,
    width: "300",
    height: "auto",
    beforeclose: function(event, ui) {
      if (_prevent_close == true) return false;
    },
    open: function() {
      if (auto_ok != null && ok_fn != null) {
        if (auto_ok == true) auto_ok = 3000;
        auto_ok_timer = setTimeout(function() {
          ok_fn();
          auto_ok_timer = null;
        }, auto_ok);
      }
    }
  });
}

function close_message_dialog() {
  _prevent_close = false;
  jQuery("#dialog-message").dialog('close');
}

function is_chrome() {
  return (navigator.userAgent.toLowerCase().indexOf('chrome') > -1);
}

function get_date_from_text(dateText) {

  var array = dateText.split("-");
  var year = parseInt(array[0], 10);
  var month = parseInt(array[1], 10) - 1;
  var day = parseInt(array[2], 10);

  return new Date(year, month, day);
}

function get_text_from_date(date) {

  var year = date.getFullYear();
  var month = date.getMonth() + 1;
  var day = date.getDate();

  if (month < 10) month = '0'+month;
  if (day < 10) day = '0'+day;

  return (year+'-'+month+'-'+day);
}

function member_forgot_password(){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/member-forgot-password.php',
            height:     302,
            width:      600
          });
}

function client_login(){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/client_login.php',
            height:     302,
            width:      600
          });

}

function client_send_email(property_id){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/client_send_email.php?pid=' + property_id,
            height:     302,
            width:      600
          });

}

function view_map(property_id){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/view_map.php?pid=' + property_id,
            height:     480,
            width:      640
          });

}

function view_image(path){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/view_image.php?path=' + path,
            height:     480,
            width:      640
          });

}

function edit_amenities(pid){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/property_amenities.php?pid=' + pid,
            height:     330,
            width:      670
          });

}

var shadowbox_payment_do_reload = false;

function pay_for_listing(pid)
{
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/property_pay.php?pid=' + pid,
            height:     530,
            width:      800
          });
          
  shadowbox_payment_do_reload = true;
}

function edit_rate_info(pid){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/property_rate_info.php?pid=' + pid,
            height:     330,
            width:      670
          });

}

function edit_contact_details(pid){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/property_contacts.php?pid=' + pid,
            height:     430,
            width:      670
          });

}

function edit_member_languages(){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/member_languages.php',
            height:     380,
            width:      370
          });

}

function show_whats_going_on(id){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/what-s-going-on.php?id=' + id,
            height:     480,
            width:      730
          });

}

function show_whats_going_on_blog(id){
  Shadowbox.open({
            player:     'iframe',
            title:      '',
            content:    root_dir + '/what-s-going-on-blog.php?id=' + id,
            height:     480,
            width:      730
          });

}

//CREDIT:
//http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

function scrollTo(selector, minus) {
  if (minus == null) minus = 0;
  var targetOffset = jQuery(selector).offset().top - minus;
  $('html,body').animate({
    scrollTop: targetOffset
  });
}

var toggles = {};

function toggle_property_details(selector,link_selector) {
  var speed = 'fast';
  if (selector in toggles) {
    if (toggles[selector] == 0) {
      toggles[selector] = 1;
      jQuery(selector).show();
      jQuery(link_selector).effect('transfer', { to: selector }, speed, function() {
        jQuery(link_selector).html('[ click here to hide details ]');
      });
    } else {
      toggles[selector] = 0;
      jQuery(selector).effect('transfer', { to: link_selector }, speed, function() {
        jQuery(link_selector).html('[ click here to show details ]');
      });
      jQuery(selector).hide();
    }
  } else {
    toggles[selector] = 1;
    jQuery(selector).show();
    jQuery(link_selector).effect('transfer', { to: selector }, speed, function() {
      jQuery(link_selector).html('[ click here to hide details ]');
    });
  }
}

jQuery(document).ready(function() {
  jQuery("a.effect_link").click(function(event) {
    //jQuery(this).effect('transfer', { to: 'body' }, 'fast', function() {});
  });
  jQuery.preLoadImages(
    root_dir + '/images/home-tab-about-back.png',
    root_dir + '/images/home-tab-about-front.png',
    root_dir + '/images/home-tab-featured-back.png',
    root_dir + '/images/home-tab-featured-front.png',
    root_dir + '/images/had_tb2.png',
    root_dir + '/images/had_tb1.png',
    root_dir + '/style_sheet/custom-theme/images/ui-anim_basic_16x16.gif',

    root_dir + '/shadowbox/loading.gif'
  );
});

//Menu Tap
function infodisplay() {

	document.getElementById('bg_content_display').style.display = 'none';
	document.getElementById('bg_content').style.display = 'block';

	document.getElementById('nav_blog_a').style.backgroundPosition = '0 0';
	document.getElementById('nav_news_a').style.backgroundPosition = '0 27px';

}
function deliveryclick() {
	document.getElementById('bg_content').style.display = 'none';
	document.getElementById('bg_content_display').style.display = 'block';

	document.getElementById('nav_blog_a').style.backgroundPosition = '0 27px';
	document.getElementById('nav_news_a').style.backgroundPosition = '0 0';
}

function showdiv(id){
	var menu1= document.getElementById ('menu1');
	var menu2= document.getElementById ('menu2');
	var menu3= document.getElementById ('menu3');
	var menu4= document.getElementById ('menu4');
	var menu5= document.getElementById ('menu5');
	var menu6= document.getElementById ('menu6');
	var menu7= document.getElementById ('menu7');
	var menu8= document.getElementById ('menu8');
	var menu9= document.getElementById ('menu9');
	var menu10= document.getElementById ('menu10');
	if (id == 1){
	menu1.style.display = '';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 2){
	menu1.style.display = 'none';
	menu2.style.display = '';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 3){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = '';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 4){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = '';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 5){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = '';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 6){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = '';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 7){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = '';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 8){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = '';
	menu9.style.display = 'none';
	menu10.style.display = 'none';
	}
	if (id == 9){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = '';
	menu10.style.display = 'none';
	}
	if (id == 10){
	menu1.style.display = 'none';
	menu2.style.display = 'none';
	menu3.style.display = 'none';
	menu4.style.display = 'none';
	menu5.style.display = 'none';
	menu6.style.display = 'none';
	menu7.style.display = 'none';
	menu8.style.display = 'none';
	menu9.style.display = 'none';
	menu10.style.display = '';
	}
}

function coming_soon() {
  alert('Coming soon...');
}

function cleanArray(actual){
  var newArray = new Array();
  for(var i = 0; i < actual.length; i++){
    if (actual[i] != ''){
      newArray.push(actual[i]);
    }
  }
  return newArray;
}


jQuery(document).ready(function() {
  jQuery.preLoadImages(
    '/images/nav_about2.png',
    '/images/nav_ad2.png',
    '/images/nav_contact2.png',
    '/images/nav_login2.png',
    '/images/menu_bg_sub.png',
    '/images/drop_menu_curve_sub.png'
  );
  jQuery('#nav_about').mouseenter(function() {
    jQuery(this).attr('src', '/images/nav_about2.png');
  });
  jQuery('#nav_about').mouseleave(function() {
    jQuery(this).attr('src', '/images/nav_about.png');
  });

  jQuery('#nav_ad').mouseenter(function() {
    jQuery(this).attr('src', '/images/nav_ad2.png');
  });
  jQuery('#nav_ad').mouseleave(function() {
    jQuery(this).attr('src', '/images/nav_ad.png');
  });

  jQuery('#nav_contact').mouseenter(function() {
    jQuery(this).attr('src', '/images/nav_contact2.png');
  });
  jQuery('#nav_contact').mouseleave(function() {
    jQuery(this).attr('src', '/images/nav_contact.png');
  });

  var nav_login_close_timer = null;
  
  jQuery('#nav_login').mouseenter(function() {
    jQuery(this).attr('src', '/images/nav_login2.png');
    if (nav_login_close_timer != null) {
      clearTimeout(nav_login_close_timer);
      nav_login_close_timer = null;
    }
    jQuery('#nav_login_popbox').stop(true, true).slideDown('fast');
  });
  jQuery('#nav_login').mouseleave(function() {
    jQuery(this).attr('src', '/images/nav_login.png');
    nav_login_close_timer = setTimeout(function() {
      jQuery('#nav_login_popbox').stop(true, true).slideUp('fast');
      nav_login_close_timer = null;
    }, 1000);
  });
  
  jQuery('#nav_login_popbox').mouseenter(function() {
    if (nav_login_close_timer != null) {
      clearTimeout(nav_login_close_timer);
      nav_login_close_timer = null;
    }
    jQuery('#nav_login_popbox').stop(true, true).slideDown('fast');
  });
  jQuery('#nav_login_popbox').mouseleave(function() {
    nav_login_close_timer = setTimeout(function() {
      jQuery('#nav_login_popbox').stop(true, true).slideUp('fast');
      nav_login_close_timer = null;
    }, 1000);
  });
});


//{SWFObject

/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
//}


//{Niceforms

/*#############################################################
Name: Niceforms
Version: 2.0
Author: Lucian Slatineanu
URL: http://www.emblematiq.com/projects/niceforms/

Feel free to use and modify but please keep this copyright intact.
#################################################################*/

//Theme Variables - edit these to match your theme
var imagesPath = "../images/";
var selectRightWidthSimple = 19;
var selectRightWidthScroll = 2;
var selectMaxHeight = 200;
var textareaTopPadding = 10;
var textareaSidePadding = 10;

//Global Variables
var NF = new Array();
var isIE = false;
var resizeTest = 1;

//Initialization function
function NFInit() {
	try {
		document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}
	if(!document.getElementById) {return false;}
	//alert("click me first");
	NFDo('start');
}
function NFDo(what) {
	var niceforms = document.getElementsByTagName('form');
	var identifier = new RegExp('(^| )'+'niceform'+'( |$)');
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		var ieversion=new Number(RegExp.$1);
		if(ieversion < 7) {return false;} //exit script if IE6
		isIE = true;
	}
	for(var q = 0; q < niceforms.length; q++) {if(identifier.test(niceforms[q].className)) {
		if(what == "start") { //Load Niceforms
			NF[q] = new niceform(niceforms[q]);
			niceforms[q].start();
		}
		else { //Unload Niceforms
			niceforms[q].unload();
			NF[q] = "";
		}
	}}
}
function NFFix() {
	NFDo('stop');
	NFDo('start');
}
function niceform(nf) {
	nf._inputText = new Array(); nf._inputRadio = new Array(); nf._inputCheck = new Array(); nf._inputSubmit = new Array(); nf._inputFile = new Array(); nf._textarea = new Array(); nf._select = new Array(); nf._multiselect = new Array();
	nf.add_inputText = function(obj) {this._inputText[this._inputText.length] = obj; inputText(obj);}
	nf.add_inputRadio = function(obj) {this._inputRadio[this._inputRadio.length] = obj; inputRadio(obj);}
	nf.add_inputCheck = function(obj) {this._inputCheck[this._inputCheck.length] = obj; inputCheck(obj);}
	nf.add_inputSubmit = function(obj) {this._inputSubmit[this._inputSubmit.length] = obj; inputSubmit(obj);}
	nf.add_inputFile = function(obj) {this._inputFile[this._inputFile.length] = obj; inputFile(obj);}
	nf.add_textarea = function(obj) {this._textarea[this._textarea.length] = obj; textarea(obj);}
	nf.add_select = function(obj) {this._select[this._select.length] = obj; selects(obj);}
	nf.add_multiselect = function(obj) {this._multiselect[this._multiselect.length] = obj; multiSelects(obj);}
	nf.start = function() {
		//Separate and assign elements
		var allInputs = this.getElementsByTagName('input');
		for(var w = 0; w < allInputs.length; w++) {
			switch(allInputs[w].type) {
				case "text": case "password": {this.add_inputText(allInputs[w]); break;}
				case "radio": {this.add_inputRadio(allInputs[w]); break;}
				case "checkbox": {this.add_inputCheck(allInputs[w]); break;}
				case "submit": case "reset": case "button": {this.add_inputSubmit(allInputs[w]); break;}
				case "file": {this.add_inputFile(allInputs[w]); break;}
			}
		}
		var allButtons = this.getElementsByTagName('button');
		for(var w = 0; w < allButtons.length; w++) {
			this.add_inputSubmit(allButtons[w]);
		}
		var allTextareas = this.getElementsByTagName('textarea');
		for(var w = 0; w < allTextareas.length; w++) {
			this.add_textarea(allTextareas[w]);
		}
		var allSelects = this.getElementsByTagName('select');
		for(var w = 0; w < allSelects.length; w++) {
			if(allSelects[w].size == "1") {this.add_select(allSelects[w]);}
			else {this.add_multiselect(allSelects[w]);}
		}
		//Start
		for(w = 0; w < this._inputText.length; w++) {this._inputText[w].init();}
		for(w = 0; w < this._inputRadio.length; w++) {this._inputRadio[w].init();}
		for(w = 0; w < this._inputCheck.length; w++) {this._inputCheck[w].init();}
		for(w = 0; w < this._inputSubmit.length; w++) {this._inputSubmit[w].init();}
		for(w = 0; w < this._inputFile.length; w++) {this._inputFile[w].init();}
		for(w = 0; w < this._textarea.length; w++) {this._textarea[w].init();}
		for(w = 0; w < this._select.length; w++) {this._select[w].init(w);}
		for(w = 0; w < this._multiselect.length; w++) {this._multiselect[w].init(w);}
	}
	nf.unload = function() {
		//Stop
		for(w = 0; w < this._inputText.length; w++) {this._inputText[w].unload();}
		for(w = 0; w < this._inputRadio.length; w++) {this._inputRadio[w].unload();}
		for(w = 0; w < this._inputCheck.length; w++) {this._inputCheck[w].unload();}
		for(w = 0; w < this._inputSubmit.length; w++) {this._inputSubmit[w].unload();}
		for(w = 0; w < this._inputFile.length; w++) {this._inputFile[w].unload();}
		for(w = 0; w < this._textarea.length; w++) {this._textarea[w].unload();}
		for(w = 0; w < this._select.length; w++) {this._select[w].unload();}
		for(w = 0; w < this._multiselect.length; w++) {this._multiselect[w].unload();}
	}
}
function inputText(el) { //extent Text inputs
	el.oldClassName = el.className;
	el.left = document.createElement('img');
	el.left.src = imagesPath + "0.png";
	el.left.className = "NFTextLeft";
	el.right = document.createElement('img');
	el.right.src = imagesPath + "0.png";
	el.right.className = "NFTextRight";
	el.dummy = document.createElement('div');
	el.dummy.className = "NFTextCenter";
	el.onfocus = function() {
		this.dummy.className = "NFTextCenter NFh";
		this.left.className = "NFTextLeft NFh";
		this.right.className = "NFTextRight NFh";
	}
	el.onblur = function() {
		this.dummy.className = "NFTextCenter";
		this.left.className = "NFTextLeft";
		this.right.className = "NFTextRight";
	}
	el.init = function() {
		this.parentNode.insertBefore(this.left, this);
		this.parentNode.insertBefore(this.right, this.nextSibling);
		this.dummy.appendChild(this);
		this.right.parentNode.insertBefore(this.dummy, this.right);
		this.className = "NFText";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.left);
		this.parentNode.removeChild(this.right);
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
}
function inputRadio(el) { //extent Radio buttons
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	if(el.checked) {el.dummy.className = "NFRadio NFh";}
	else {el.dummy.className = "NFRadio";}
	el.dummy.ref = el;
	if(isIE == false) {el.dummy.style.left = findPosX(el) + 'px'; el.dummy.style.top = findPosY(el) + 'px';}
	else {el.dummy.style.left = findPosX(el) + 4 + 'px'; el.dummy.style.top = findPosY(el) + 4 + 'px';}
	el.dummy.onclick = function() {
		if(!this.ref.checked) {
			var siblings = getInputsByName(this.ref.name);
			for(var q = 0; q < siblings.length; q++) {
				siblings[q].checked = false;
				siblings[q].dummy.className = "NFRadio";
			}
			this.ref.checked = true;
			this.className = "NFRadio NFh";
		}
	}
	el.onclick = function() {
		if(this.checked) {
			var siblings = getInputsByName(this.name);
			for(var q = 0; q < siblings.length; q++) {
				siblings[q].dummy.className = "NFRadio";
			}
			this.dummy.className = "NFRadio NFh";
		}
	}
	el.onfocus = function() {this.dummy.className += " NFfocused";}
	el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.init = function() {
		this.parentNode.insertBefore(this.dummy, this);
		el.className = "NFhidden";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
}
function inputCheck(el) { //extend Checkboxes
	el.oldClassName = el.className;
	el.dummy = document.createElement('img');
	el.dummy.src = imagesPath + "0.png";
	if(el.checked) {el.dummy.className = "NFCheck NFh";}
	else {el.dummy.className = "NFCheck";}
	el.dummy.ref = el;
	if(isIE == false) {el.dummy.style.left = findPosX(el) + 'px'; el.dummy.style.top = findPosY(el) + 'px';}
	else {el.dummy.style.left = findPosX(el) + 4 + 'px'; el.dummy.style.top = findPosY(el) + 4 + 'px';}
	el.dummy.onclick = function() {
		if(!this.ref.checked) {
			this.ref.checked = true;
			this.className = "NFCheck NFh";
		}
		else {
			this.ref.checked = false;
			this.className = "NFCheck";
		}
	}
	el.onclick = function() {
		if(this.checked) {this.dummy.className = "NFCheck NFh";}
		else {this.dummy.className = "NFCheck";}
	}
	el.onfocus = function() {this.dummy.className += " NFfocused";}
	el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.init = function() {
		this.parentNode.insertBefore(this.dummy, this);
		el.className = "NFhidden";
	} 
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
}
function inputSubmit(el) { //extend Buttons
	el.oldClassName = el.className;
	el.left = document.createElement('img');
	el.left.className = "NFButtonLeft";
	el.left.src = imagesPath + "0.png";
	el.right = document.createElement('img');
	el.right.src = imagesPath + "0.png";
	el.right.className = "NFButtonRight";
	el.onmouseover = function() {
		this.className = "NFButton NFh";
		this.left.className = "NFButtonLeft NFh";
		this.right.className = "NFButtonRight NFh";
	}
	el.onmouseout = function() {
		this.className = "NFButton";
		this.left.className = "NFButtonLeft";
		this.right.className = "NFButtonRight";
	}
	el.init = function() {
		this.parentNode.insertBefore(this.left, this);
		this.parentNode.insertBefore(this.right, this.nextSibling);
		this.className = "NFButton";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.left);
		this.parentNode.removeChild(this.right);
		this.className = this.oldClassName;
	}
}
function inputFile(el) { //extend File inputs
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummy.className = "NFFile";
	el.file = document.createElement('div');
	el.file.className = "NFFileNew";
	el.center = document.createElement('div');
	el.center.className = "NFTextCenter";
	el.clone = document.createElement('input');
	el.clone.type = "text";
	el.clone.className = "NFText";
	el.clone.ref = el;
	el.left = document.createElement('img');
	el.left.src = imagesPath + "0.png";
	el.left.className = "NFTextLeft";
	el.button = document.createElement('img');
	el.button.src = imagesPath + "0.png";
	el.button.className = "NFFileButton";
	el.button.ref = el;
	el.button.onclick = function() {this.ref.click();}
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(this.dummy, where);
		this.dummy.appendChild(this);
		this.center.appendChild(this.clone);
		this.file.appendChild(this.center);
		this.file.insertBefore(this.left, this.center);
		this.file.appendChild(this.button);
		this.dummy.appendChild(this.file);
		this.className = "NFhidden";
		this.relatedElement = this.clone;
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
	el.onchange = el.onmouseout = function() {this.relatedElement.value = this.value;}
	el.onfocus = function() {
		this.left.className = "NFTextLeft NFh";
		this.center.className = "NFTextCenter NFh";
		this.button.className = "NFFileButton NFh";
	}
	el.onblur = function() {
		this.left.className = "NFTextLeft";
		this.center.className = "NFTextCenter";
		this.button.className = "NFFileButton";
	}
	el.onselect = function() {
		this.relatedElement.select();
		this.value = '';
	}
}
function textarea(el) { //extend Textareas
	el.oldClassName = el.className;
	el.height = el.offsetHeight - textareaTopPadding;
	el.width = el.offsetWidth - textareaSidePadding;
	el.topLeft = document.createElement('img');
	el.topLeft.src = imagesPath + "0.png";
	el.topLeft.className = "NFTextareaTopLeft";
	el.topRight = document.createElement('div');
	el.topRight.className = "NFTextareaTop";
	el.bottomLeft = document.createElement('img');
	el.bottomLeft.src = imagesPath + "0.png";
	el.bottomLeft.className = "NFTextareaBottomLeft";
	el.bottomRight = document.createElement('div');
	el.bottomRight.className = "NFTextareaBottom";
	el.left = document.createElement('div');
	el.left.className = "NFTextareaLeft";
	el.right = document.createElement('div');
	el.right.className = "NFTextareaRight";
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(el.topRight, where);
		top.insertBefore(el.right, where);
		top.insertBefore(el.bottomRight, where);
		this.topRight.appendChild(this.topLeft);
		this.right.appendChild(this.left);
		this.right.appendChild(this);
		this.bottomRight.appendChild(this.bottomLeft);
		el.style.width = el.topRight.style.width = el.bottomRight.style.width = el.width + 'px';
		el.style.height = el.left.style.height = el.right.style.height = el.height + 'px';
		this.className = "NFTextarea";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.topRight);
		this.parentNode.removeChild(this.bottomRight);
		this.parentNode.removeChild(this.right);
		this.className = this.oldClassName;
		this.style.width = this.style.height = "";
	}
	el.onfocus = function() {
		this.topLeft.className = "NFTextareaTopLeft NFh";
		this.topRight.className = "NFTextareaTop NFhr";
		this.left.className = "NFTextareaLeftH";
		this.right.className = "NFTextareaRightH";
		this.bottomLeft.className = "NFTextareaBottomLeft NFh";
		this.bottomRight.className = "NFTextareaBottom NFhr";
	}
	el.onblur = function() {
		this.topLeft.className = "NFTextareaTopLeft";
		this.topRight.className = "NFTextareaTop";
		this.left.className = "NFTextareaLeft";
		this.right.className = "NFTextareaRight";
		this.bottomLeft.className = "NFTextareaBottomLeft";
		this.bottomRight.className = "NFTextareaBottom";
	}
}
function selects(el) { //extend Selects
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummy.className = "NFSelect";
	el.dummy.style.width = el.offsetWidth + 'px';
	el.dummy.ref = el;
	el.left = document.createElement('img');
	el.left.src = imagesPath + "0.png";
	el.left.className = "NFSelectLeft";
	el.right = document.createElement('div');
	el.right.className = "NFSelectRight";
	el.txt = document.createTextNode(el.options[0].text);
	el.bg = document.createElement('div');
	el.bg.className = "NFSelectTarget";
	el.bg.style.display = "none";
	el.opt = document.createElement('ul');
	el.opt.className = "NFSelectOptions";
	el.dummy.style.left = findPosX(el) + 'px';
	el.dummy.style.top = findPosY(el) + 'px';
	el.opts = new Array(el.options.length);
	el.init = function(pos) {
		this.dummy.appendChild(this.left);
		this.right.appendChild(this.txt);
		this.dummy.appendChild(this.right);
		this.bg.appendChild(this.opt);
		this.dummy.appendChild(this.bg);
		for(var q = 0; q < this.options.length; q++) {
			this.opts[q] = new option(this.options[q], q);
			this.opt.appendChild(this.options[q].li);
			this.options[q].lnk.onclick = function() {
				this._onclick();
				this.ref.dummy.getElementsByTagName('div')[0].innerHTML = this.ref.options[this.pos].text;
				this.ref.options[this.pos].selected = "selected";
				for(var w = 0; w < this.ref.options.length; w++) {this.ref.options[w].lnk.className = "";}
				this.ref.options[this.pos].lnk.className = "NFOptionActive";
			}
		}
		if(this.options.selectedIndex) {
			this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[this.options.selectedIndex].text;
			this.options[this.options.selectedIndex].lnk.className = "NFOptionActive";
		}
		this.dummy.style.zIndex = 999 - pos;
		this.parentNode.insertBefore(this.dummy, this);
		this.className = "NFhidden";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
	el.dummy.onclick = function() {
		var allDivs = document.getElementsByTagName('div'); for(var q = 0; q < allDivs.length; q++) {if((allDivs[q].className == "NFSelectTarget") && (allDivs[q] != this.ref.bg)) {allDivs[q].style.display = "none";}}
		if(this.ref.bg.style.display == "none") {this.ref.bg.style.display = "block";}
		else {this.ref.bg.style.display = "none";}
		if(this.ref.opt.offsetHeight > selectMaxHeight) {
			this.ref.bg.style.width = this.ref.offsetWidth - selectRightWidthScroll + 33 + 'px';
			this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthScroll + 'px';
		}
		else {
			this.ref.bg.style.width = this.ref.offsetWidth - selectRightWidthSimple + 33 + 'px';
			this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthSimple + 'px';
		}
	}
	el.bg.onmouseout = function(e) {
		if (!e) var e = window.event;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if((reltg.nodeName == 'A') || (reltg.nodeName == 'LI') || (reltg.nodeName == 'UL')) return;
		if((reltg.nodeName == 'DIV') || (reltg.className == 'NFSelectTarget')) return;
		else{this.style.display = "none";}
	}
	el.dummy.onmouseout = function(e) {
		if (!e) var e = window.event;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if((reltg.nodeName == 'A') || (reltg.nodeName == 'LI') || (reltg.nodeName == 'UL')) return;
		if((reltg.nodeName == 'DIV') || (reltg.className == 'NFSelectTarget')) return;
		else{this.ref.bg.style.display = "none";}
	}
	el.onfocus = function() {this.dummy.className += " NFfocused";}
	el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.onkeydown = function(e) {
		if (!e) var e = window.event;
		var thecode = e.keyCode;
		var active = this.selectedIndex;
		switch(thecode){
			case 40: //down
				if(active < this.options.length - 1) {
					for(var w = 0; w < this.options.length; w++) {this.options[w].lnk.className = "";}
					var newOne = active + 1;
					this.options[newOne].selected = "selected";
					this.options[newOne].lnk.className = "NFOptionActive";
					this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[newOne].text;
				}
				return false;
				break;
			case 38: //up
				if(active > 0) {
					for(var w = 0; w < this.options.length; w++) {this.options[w].lnk.className = "";}
					var newOne = active - 1;
					this.options[newOne].selected = "selected";
					this.options[newOne].lnk.className = "NFOptionActive";
					this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[newOne].text;
				}
				return false;
				break;
			default:
				break;
		}
	}
}
function multiSelects(el) { //extend Multiple Selects
	el.oldClassName = el.className;
	el.height = el.offsetHeight;
	el.width = el.offsetWidth;
	el.topLeft = document.createElement('img');
	el.topLeft.src = imagesPath + "0.png";
	el.topLeft.className = "NFMultiSelectTopLeft";
	el.topRight = document.createElement('div');
	el.topRight.className = "NFMultiSelectTop";
	el.bottomLeft = document.createElement('img');
	el.bottomLeft.src = imagesPath + "0.png";
	el.bottomLeft.className = "NFMultiSelectBottomLeft";
	el.bottomRight = document.createElement('div');
	el.bottomRight.className = "NFMultiSelectBottom";
	el.left = document.createElement('div');
	el.left.className = "NFMultiSelectLeft";
	el.right = document.createElement('div');
	el.right.className = "NFMultiSelectRight";
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(el.topRight, where);
		top.insertBefore(el.right, where);
		top.insertBefore(el.bottomRight, where);
		this.topRight.appendChild(this.topLeft);
		this.right.appendChild(this.left);
		this.right.appendChild(this);
		this.bottomRight.appendChild(this.bottomLeft);
		el.style.width = el.topRight.style.width = el.bottomRight.style.width = el.width + 'px';
		el.style.height = el.left.style.height = el.right.style.height = el.height + 'px';
		el.className = "NFMultiSelect";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.topRight);
		this.parentNode.removeChild(this.bottomRight);
		this.parentNode.removeChild(this.right);
		this.className = this.oldClassName;
		this.style.width = this.style.height = "";
	}
	el.onfocus = function() {
		this.topLeft.className = "NFMultiSelectTopLeft NFh";
		this.topRight.className = "NFMultiSelectTop NFhr";
		this.left.className = "NFMultiSelectLeftH";
		this.right.className = "NFMultiSelectRightH";
		this.bottomLeft.className = "NFMultiSelectBottomLeft NFh";
		this.bottomRight.className = "NFMultiSelectBottom NFhr";
	}
	el.onblur = function() {
		this.topLeft.className = "NFMultiSelectTopLeft";
		this.topRight.className = "NFMultiSelectTop";
		this.left.className = "NFMultiSelectLeft";
		this.right.className = "NFMultiSelectRight";
		this.bottomLeft.className = "NFMultiSelectBottomLeft";
		this.bottomRight.className = "NFMultiSelectBottom";
	}
}
function option(el, no) { //extend Options
	el.li = document.createElement('li');
	el.lnk = document.createElement('a');
	el.lnk.href = "javascript:;";
	el.lnk.ref = el.parentNode;
	el.lnk.pos = no;
	el.lnk._onclick = el.onclick || function () {};
	el.txt = document.createTextNode(el.text);
	el.lnk.appendChild(el.txt);
	el.li.appendChild(el.lnk);
}

//Get Position
function findPosY(obj) {
	var posTop = 0;
	do {posTop += obj.offsetTop;} while (obj = obj.offsetParent);
	return posTop;
}
function findPosX(obj) {
	var posLeft = 0;
	do {posLeft += obj.offsetLeft;} while (obj = obj.offsetParent);
	return posLeft;
}
//Get Siblings
function getInputsByName(name) {
	var inputs = document.getElementsByTagName("input");
	var w = 0; var results = new Array();
	for(var q = 0; q < inputs.length; q++) {if(inputs[q].name == name) {results[w] = inputs[q]; ++w;}}
	return results;
}

//Add events
var existingLoadEvent = window.onload || function () {};
var existingResizeEvent = window.onresize || function() {};
window.onload = function () {
    existingLoadEvent();
    NFInit();
}
window.onresize = function() {
	if(resizeTest != document.documentElement.clientHeight) {
		existingResizeEvent();
		NFFix();
	}
	resizeTest = document.documentElement.clientHeight;
}
//}


//{pngFix

/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

//(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif',
    notsel: ''
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").not(settings.notsel).each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'crop\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").not(settings.notsel).each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='crop')";
			}
		});

		//fix input with png-source
		jQuery(this).find("input[src$=.png]").not(settings.notsel).each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'crop\');';
   		jQuery(this).attr('src', settings.blankgif)
		});

	}

	return jQuery;

};

// })(jQuery);
//}


//{bgIframe

/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
 * $Rev: 2447 $
 *
 * Version 2.1.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0){this.insertBefore(document.createElement(html),this.firstChild);}});}return this;};})(jQuery);
//}


//{elastic

(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;}
var $textarea=jQuery(this),$twin=jQuery('<div />').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;}
$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));}
function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}}
function update(){var textareaContent=$textarea.val().replace(/&/g,'&amp;').replace(/  /g,'&nbsp;').replace(/<|>/g,'&gt;').replace(/\n/g,'<br />');var twinContent=$twin.html();if(textareaContent+'&nbsp;'!=twinContent){$twin.html(textareaContent+'&nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}}
$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery);
//}


//{Facebox

/*
 * Facebox (for jQuery)
 * version: 1.2 (05/05/2008)
 * @requires jQuery v1.2 or later
 *
 * Examples at http://famspam.com../images/
 *
 * Licensed under the MIT:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
 *
 * Usage:
 *  
 *  jQuery(document).ready(function() {
 *    jQuery('a[rel*=facebox]').facebox() 
 *  })
 *
 *  <a href="#terms" rel="facebox">Terms</a>
 *    Loads the #terms div in the box
 *
 *  <a href="terms.html" rel="facebox">Terms</a>
 *    Loads the terms.html page in the box
 *
 *  <a href="terms.png" rel="facebox">Terms</a>
 *    Loads the terms.png image in the box
 *
 *
 *  You can also use it programmatically:
 * 
 *    jQuery.facebox('some html')
 *
 *  The above will open a facebox with "some html" as the content.
 *    
 *    jQuery.facebox(function($) { 
 *      $.get('blah.html', function(data) { $.facebox(data) })
 *    })
 *
 *  The above will show a loading screen before the passed function is called,
 *  allowing for a better ajaxy experience.
 *
 *  The facebox function can also display an ajax page or image:
 *  
 *    jQuery.facebox({ ajax: 'remote.html' })
 *    jQuery.facebox({ image: 'dude.jpg' })
 *
 *  Want to close the facebox?  Trigger the 'close.facebox' document event:
 *
 *    jQuery(document).trigger('close.facebox')
 *
 *  Facebox also has a bunch of other hooks:
 *
 *    loading.facebox
 *    beforeReveal.facebox
 *    reveal.facebox (aliased as 'afterReveal.facebox')
 *    init.facebox
 *
 *  Simply bind a function to any of these hooks:
 *
 *   $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
 *
 */
//(function($) {
  $.facebox = function(data, klass) {
    $.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax)
    else if (data.image) fillFaceboxFromImage(data.image)
    else if (data.div) fillFaceboxFromHref(data.div)
    else if ($.isFunction(data)) data.call($)
    else $.facebox.reveal(data, klass)
  }

  /*
   * Public, $.facebox methods
   */

  $.extend($.facebox, {
    settings: {
      opacity      : 0.8,
      overlay      : true,
      loadingImage : root_dir + '/images/loading.gif',
      closeImage   : root_dir + '/images/closelabel.gif',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer_facebox"> \
                  <a href="#" class="close"> \
                    <img src="/images/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()

      $('#facebox .content').empty()
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

      $('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	385.5
      }).show()

      $(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) $.facebox.close()
        return true
      })
      $(document).trigger('loading.facebox')
    },

    reveal: function(data, klass) {
      $(document).trigger('beforeReveal.facebox')
      if (klass) $('#facebox .content').addClass(klass)
      $('#facebox .content').append(data)
      $('#facebox .loading').remove()
      $('#facebox .body').children().fadeIn('normal')
      $('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2))
      $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
    },

    close: function() {
      $(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, $.fn methods
   */

  $.fn.facebox = function(settings) {
    init(settings)

    function clickHandler() {
      $.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.click(clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if ($.facebox.settings.inited) return true
    else $.facebox.settings.inited = true

    $(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = $.facebox.settings.imageTypes.join('|')
    $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')

    if (settings) $.extend($.facebox.settings, settings)
    $('body').append($.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = $.facebox.settings.closeImage
    preload[1].src = $.facebox.settings.loadingImage

    $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
    })

    $('#facebox .close').click($.facebox.close)
    $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
  }
  
  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
    return new Array(xScroll,yScroll) 
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var $s = $.facebox.settings

    $s.loadingImage = $s.loading_image || $s.loadingImage
    $s.closeImage = $s.close_image || $s.closeImage
    $s.imageTypes = $s.image_types || $s.imageTypes
    $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      $.facebox.reveal($(target).clone().show(), klass)

    // image
    } else if (href.match($.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass)
    }
  }

  function fillFaceboxFromImage(href, klass) {
    var image = new Image()
    image.onload = function() {
      $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass) {
    $.get(href, function(data) { $.facebox.reveal(data, klass) })
  }

  function skipOverlay() {
    return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null 
  }

  function showOverlay() {
    if (skipOverlay()) return

    if ($('facebox_overlay').length == 0) 
      $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .click(function() { $(document).trigger('close.facebox') })
      .fadeIn(200)
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    $('#facebox_overlay').fadeOut(200, function(){
      $("#facebox_overlay").removeClass("facebox_overlayBG")
      $("#facebox_overlay").addClass("facebox_hide") 
      $("#facebox_overlay").remove()
    })
    
    return false
  }

  /*
   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      hideOverlay()
      $('#facebox .loading').remove()
    })
  })

// })(jQuery);
//}


function psearch_add_to_view_list(id, from_selector, to_selector, view_max, callback, remove_index) {
  if (view_max == null) view_max = 3;

  if (from_selector != null && to_selector != null) {
    jQuery(from_selector).effect('transfer', { to: to_selector }, 'slow', function() {
      jQuery('#psearch_list_items').html('<div style="padding-bottom: 10px;"><img src="/style_sheet/custom-theme/images/ui-anim_basic_16x16.gif" /></div>');
      jQuery.ajax({
        type: 'POST',
        url: root_dir + '/ajax/psearch_add_to_view_list.ajx.php',
        data: { pid: id, view_max: view_max },
        success: function(data) {
          jQuery('#psearch_list_items').html(data);
        }
      });
    });
  } else {
    if (remove_index == null) remove_index = 0;
    jQuery('#psearch_list_items').html('<div style="padding-bottom: 10px;"><img src="/style_sheet/custom-theme/images/ui-anim_basic_16x16.gif" /></div>');
    jQuery.ajax({
      type: 'POST',
      url: root_dir + '/ajax/psearch_add_to_view_list.ajx.php',
      data: { pid: id, view_max: view_max, remove_index: remove_index },
      success: function(data) {
        jQuery('#psearch_list_items').html(data);
        if (callback != null) callback();
        
        setTimeout(function() {
          jQuery('#psearch_list_items').pngFix({
            blankgif: root_dir + '/images/blank.gif',
            notsel: '#dialog-message *, .nopngfix, .ui-widget *'
          });
        }, 200);
        
      }
    });
  }
}

jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox({
  loading_image : '/images/loading.gif',
  close_image   : '/images/closelabel.gif'
  })
})

function changediv(text){
  textshow.innerHTML = text;
}

jQuery(document).ready(function() {
  setTimeout(function() {
    jQuery(document).pngFix({
      blankgif: root_dir + '/images/blank.gif',
      notsel: '#dialog-message *, .nopngfix, .ui-widget *'
    });
  }, 200);
});


jQuery(document).ready(function() {

// dropdown

  $("#dropdown").hover(
    function() {
     var hidden = $("#dropdown_menu").is(":hidden");
      if (hidden) {
        $("#dropdown_menu").show();
        $(".dropdown a").css({'background-position' : '0px 28px'});

      }
    },
    function () {

        $("#dropdown_menu").hide();
        $(".dropdown a").css({'background-position' : '0px 0px'});

    })
// dropdown2

  $("#dropdown2").hover(
    function() {
      var hidden = $("#dropdown2_menu").is(":hidden");
      if (hidden) {
        $("#dropdown2_menu").show();
        $(".dropdown2 a").css({'background-position' : '0px 28px'});

      }
    },
    function () {

        $("#dropdown2_menu").hide();
        $(".dropdown2 a").css({'background-position' : '0px 0px'});

    })
// dropdown3

  $("#dropdown3").hover(
    function() {
      var hidden = $("#dropdown3_menu").is(":hidden");
      if (hidden) {
        $("#dropdown3_menu").show();
        $(".dropdown3 a").css({'background-position' : '0px 28px'});

      }
    },
    function () {

        $("#dropdown3_menu").hide();
        $(".dropdown3 a").css({'background-position' : '0px 0px'});

    })

// newsletter
  $(".subscribe").hover(
    function() {
      var hidden = $("div",this).is(":hidden");
      if (hidden) {
        $("div",this).toggle("drop");
      }
    },
    function () {
      $("div",this).toggle("drop");
    })
});


function Gload()
{
  var obj= new GmapClass();
  obj.setMapType('big'); //#'small' is default
  obj.lat=-37.862392; //#pass latitude
  obj.lng=145.009923; //#pass longitude
  //obj.setAddress='Melbourne, Australia'; //# this will take any address and center the map accordingly (no need of lat/lng). But with this, the street map is not enabled .
  obj.enableScroll=true; //# true by default ; if true then zoom in/out ON Mouse scroll is enabled
  obj.markerText='<div style="font-family: Arial; font-size: 12px; color: #333333; margin-top: 0px; margin-bottom: 12px; font-weight: bold;">Locazion Pty Ltd<\/div>'
        + '<div style="width: 220px; font-family: Arial; font-size: 11px; color: #333333;">'
          +  '<div style="width: 53px; float: right;">'
          +    '<div style="">'
          +      '<div style="width: 48; margin: 0px; overflow: hidden;">'
          +        '<img src="/images/logo48.gif" />'
          +      '</div>'
          +    '</div>'
          +  '</div>'
        + '5/331 Orrong Road<br />'
        + 'St Kilda East VIC 3183<br />'
        + 'Australia<\/div>'; //# This is the text that appears in overlay
  obj.setStreetMap=true;
  obj.setStreetMapId='pann'
  obj.hybridMap=true;
  obj.loadGmap();
  glatlng=new GLatLng(-37.862392,145.009923);
  obj.setStreetFlash();
}

function openList(id){var obj=document.getElementById(id);if(obj!=null){if(obj.style.display==''||obj.style.display=='none')
{obj.style.display='block';}
else
{obj.style.display='none';}}}

