﻿/// <reference path="../../webedit/dotnet/js/jquery-1.3.1-vsdoc.js" />
var platformurl = 'http://www.raa.com.au/';

$(document).ready(function() {
	var deviceAgent = navigator.userAgent.toLowerCase();3.	
	var iOS = deviceAgent.match(/(iphone|ipod|ipad)/);
						   
    $("#leftNav li.tertiary").prev().css("background", "#FFF"); //REMOVES THE LINE BETWEEEN THE LI'S FOR THE LEFT MENU
    $('.searchbox').click(function() {
        if ($(this).val() == "Enter keywords") {
            $(this).val("");
        }
    });
    $('.searchbox').blur(function() {
        if ($(this).val() == "") {
            $(this).val("Enter keywords");
        }
    });

    $('#home_subscribe_email').click(function() {
        if ($(this).val() == "Enter your email address") {
            $(this).val("");
        }
    });
    $('#home_subscribe_email').blur(function() {
        if ($(this).val() == "") {
            $(this).val("Enter your email address");
        }
    });

    $('#home_subscribe_btn').click(function() {
        window.location = 'page.aspx?terid=105&e=' + $('#home_subscribe_email').val();
        return false;
    });

    $('.colorboximage').colorbox({ transition: 'fade', speed: 500 });

    $(".colorboxiframe").click(function() {
        var obj = eval($(this).attr("rel"));
        $(this).colorbox({ open: true, initialWidth: obj['width'], width: obj['width'], initialHeight: obj['height'], height: obj['height'], iframe: true, opacity: 0.7 });
        return false;
    });

//    $('.jwplayer').each(function() {
//        var obj = eval($(this).attr("rel"));
//		if(iOS){
//			$(this).html("<video width='"+obj['width']+"' height='"+obj['height']+"' controls><source src='http://wpc.19E2.edgecastcdn.net/0019E2/videos/apple/LocustVideoFinal_10233519.m3u8' type='audio/x-mpegurl' /><source src='http://wpc.19E2.edgecastcdn.net/0019E2/videos/mp4_test2_vhigh.mp4' type='video/mp4' /></video>")
//		}else{
//			$(this).flash({ src: 'MediaLibrary/video/mediaplayer-5.3-licensed/player.swf',
//				width: obj['width'],
//				height: obj['height'],
//				wmode: 'opaque',
//				allowscriptaccess: 'always',
//				allowfullscreen: true,
//				flashvars: { file: obj['file'], plugins: 'gapro-1&gapro.accountid=UA-15180081-1' }
//			});
//		}
//    });






    $('.jwplayerAudio').each(function() {
        var obj = eval($(this).attr("rel"));
		if(iOS){
			$(this).html("<audio controls=\"controls\" preload=\"none\"  src='"+obj['file']+"'>?Audio content could not be displayed on your browser.</audio>")
		}else{
			// full path given, no need to provide path
			$(this).flash({ src: 'MediaLibrary/video/mediaplayer-5.3-licensed/player.swf',
				id: $(this).attr('id'),
				width: obj['width'],
				height: obj['height'],
				wmode: 'opaque',
				allowscriptaccess: 'always',
				allowfullscreen: true,
				flashvars: { file: obj['file'], plugins: 'gapro-1,sharing-3', 'gapro.accountid': 'UA-5184527-2', 'sharing.link': window.location, skin: platformurl + 'jwplayer/newtube.zip' }
			});
		}
    });
    
    $('.jwplayerreplace').each(function() {
    	var obj = eval($(this).attr("rel"));
		if(iOS){
			$(this).html("<video width='"+obj['width']+"' height='"+obj['height']+"' src='http://wpc.19E2.edgecastcdn.net/0019E2/videos/apple/"+obj['file'].replace(".xml",".m3u8")+"'>Video content could not be displayed on your browser.</video>")
		}else{
			if(obj['file'].indexOf('://') == -1) {
			    // add standard path to file parameter
			    $(this).flash({ src: 'MediaLibrary/video/mediaplayer-5.3-licensed/player.swf',
			        id: $(this).attr('id'),
				    width: obj['width'],
				    height: obj['height'],
				    wmode: 'opaque',
				    allowscriptaccess: 'always',
				    allowfullscreen: true,
				    flashvars: { file: platformurl + 'MediaLibrary/video/video_playlist/' + obj['file'], plugins: 'gapro-1,sharing-3', 'gapro.accountid': 'UA-5184527-2', 'sharing.link': window.location, skin: platformurl + 'jwplayer/newtube.zip' }
			    });
			}
			else {
			    // full path given, no need to provide path
			    $(this).flash({ src: 'MediaLibrary/video/mediaplayer-5.3-licensed/player.swf',
			        id: $(this).attr('id'),
				    width: obj['width'],
				    height: obj['height'],
				    wmode: 'opaque',
				    allowscriptaccess: 'always',
				    allowfullscreen: true, //image: 'http://raa.plastyk.com.au/MediaLibrary/video/mediaplayer-5.3-licensed/video_bg.gif',
				    flashvars: { file: obj['file'], plugins: 'gapro-1,sharing-3', 'gapro.accountid': 'UA-5184527-2', 'sharing.link': window.location, skin: platformurl + '/jwplayer/newtube.zip' }
			    });
			}
		}
    });


    $("#btn_googlesearch").click(function () {
        var q = $("#txt_googlesearch").val();
        q = (q == "" || q == "Enter keywords") ? "" : "&q=" + q;
        window.location = 'google_search.asp?SecID=90' + q;
    });
});

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5184527-2']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


