// JavaScript Document

// give and links you want to use this with an id="iOSlink"

var deviceAgent = navigator.userAgent.toLowerCase();
$iOS = deviceAgent.match(/(iphone|ipod|ipad)/);

if ($iOS) {
	var jQueryScriptOutputted = false;
	function initJQuery() {
	    //if the jQuery object isn't available
	    if (typeof(jQuery) == 'undefined') {
	        if (! jQueryScriptOutputted) {
	            //only output the script once..
	            jQueryScriptOutputted = true;
	            //output the script (load it from google api)
	            document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://i.models.com/mdcdb/js/jquery-1.4.2.min.js\"></scr" + "ipt>");
	        }
	        setTimeout("initJQuery()", 50);
	    } else {
			// 
	        $(function() {
	            //do anything that needs to be done on document.ready
				$('#iOSlink').live('touchend', function(e) {
					// alert('test');
				    var el = $(this);
				    var link = el.attr('href');
				    window.location = link;
				});
	        });
	    }     
	}
	initJQuery();
}
