﻿// JScript File

function OpenWindow(url, w, h, winname){
    winX = screen.width/2;
    winY = screen.height/2;
    offsetX = w/2;
    offsetY = h/2;
    positionX = winX - offsetX;
    positionY = winY- offsetY;

    myRef = window.open(url , winname,"left="+positionX+",top="+positionY+",width="+w+",height="+h+",toolbar=0,resizable=0, scrollbars=1, menubar=0, status=1 ");

    if (parseInt(navigator.appVersion) >= 4) { 
        myRef.window.focus(); 
    }
}


function onNews() {
	//$("#sidebar1 div").removeClass("current");
	//$('#copy-' + this.id).addClass("current");
}

$(document).ready(function(){
	//Start slideshow
	$('#main-image').cycle({
		/*fx:   'shuffle', 
        shuffle: { 
            top:  -155, 
            left:  30 
        }, 
        easing: 'easeInOutBack', 
        delay: -2000 
*/

		delay:3000,
		speed:500,
		before: onNews,
		pager: '#news',
		pagerEvent: 'mouseover',
		pagerAnchorBuilder: function(idx, slide) {
			return 'div.newsitem:eq(' + (idx) + ')';
		}
	});
	
	
});


function checkVideo() {
        if (document.createElement('video').canPlayType) { //if browser supports HTML5 video
            var vidTest = document.createElement("video");
            oggTest = vidTest.canPlayType('video/ogg; codecs="theora, vorbis"'); //ogg format
            if (!oggTest) { //if it doesnot support .ogg format
                h264Test = vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"'); //mp4 format
                if (!h264Test) { //if it doesnot support .mp4 format
                    //supportMsgElement.innerHTML = "<h3>Your browser doesnot support HTML5 Video and is playing a flash video</h3>";                                                   
                    return "flash"; //play flash
                }
                else {
                    if (h264Test == "probably") {  //supports .mp4 format
                        //supportMsgElement.innerHTML = "<h3>Your browser supports HTML5 Video and is playing a .mp4 format</h3>";                     
                        return "html5"; //play HTML5 video
                    }
                    else {
                        //supportMsgElement.innerHTML = "<h3>Your browser doesnot support HTML5 Video and is playing a flash video</h3>";                                                     
                        return "flash"; //play flash video if it doesnot support any of them.
                    }
                }
            }
            else {
                if (oggTest == "probably") { //supports .ogg format
                    //supportMsgElement.innerHTML = "<h3>Your browser supports HTML5 Video and is playing a .ogg format</h3>";                                       
                    return "html5"; //play HTML5 video
                }
                else {
                    //supportMsgElement.innerHTML = "<h3>Your browser doesnot support HTML5 Video and is playing a flash video</h3>";                               
                    return "flash"; //play flash video if it doesnot support any of them.
                }
            }
        }
        else { //browser doesnot support HTML5 video, play flash instead.
            //supportMsgElement.innerHTML = "<h3>Your browser doesnot support HTML5 Video and is playing a flash video</h3>";                                
            return "flash";
        }
    }   
