﻿var _yoxslidePath = getYoxslidePath();
document.write('<link rel="Stylesheet" type="text/css" href="' + _yoxslidePath + 'yoxslide.css" />');

function LoadScript( url )
{
	document.write( '<scr' + 'ipt type="text/javascript" src="' + url + '"><\/scr' + 'ipt>' ) ;
}

var jQueryIsLoaded = typeof jQuery != "undefined";

if (!jQueryIsLoaded)
    LoadScript("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
    
if (!jQueryIsLoaded || !jQuery().jsonp)
    LoadScript(_yoxslidePath + "jquery.jsonp-1.0.4.min.js");

if (typeof Yox == "undefined")
    LoadScript(_yoxslidePath + "yox.js");

LoadScript(_yoxslidePath + "jquery.yoxscroll.js");
LoadScript(_yoxslidePath + "jquery.yoxslide.js");

function getYoxslidePath()
{
    var scripts = document.getElementsByTagName("script");
    var regex = /(.*\/)yoxslide-init\.js/i;
    for(var i=0; i<scripts.length; i++)
    {
        var currentScriptSrc = scripts[i].src;
        if (currentScriptSrc.match(regex))
            return currentScriptSrc.match(regex)[1];
    }
    
    return null;
}
// Remove the next line's comment to apply yoxslide without knowing jQuery to all containers with class 'yoxslide':
//LoadScript(_yoxslidePath + "yoxslide-nojquery.js"); 
