"use strict";
/* even before the dom is ready redirect if not in frame */
var base_url, orig_hash, this_base_url;
if(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/) == null)
{
orig_hash = window.location.hash.substring(1);
base_url = top.location.href;
if(base_url.lastIndexOf('#') != -1)
{
    base_url = base_url.substring(0,base_url.lastIndexOf('#'));
}
base_url = base_url.substr(23);
this_base_url = window.location.href;
if(this_base_url.lastIndexOf('#') != -1)
{
    this_base_url = this_base_url.substring(0,this_base_url.lastIndexOf('#'));
}
this_base_url = this_base_url.substr(23);

if(top.location.href == window.location.href && orig_hash.substring(0,1) != "/") // if we are not in a frame
{
    window.parent.location.href = "http://www.ypsphere.com/#" + base_url;
}

if(this_base_url != "/" && top.location.hash != "#" + this_base_url)
{
 //   if(!jQuery.browser.webkit)
 //   {
        top.window.location.hash = this_base_url;
 //   }
}
}
/*--- Application Core.  This just starts things, nothing else. ---*/
jQuery(document).ready(function ()
{
    if (jQuery.browser.opera)
    {
        jQuery('html').addClass('opera');
    }
    if(jQuery('#mycarousel'))
    {
        jQuery('#mycarousel').jcarousel();
    }
    if(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/) == null)
    {
        window.parent.document.title = document.title;
    }
});

