﻿// JScript File

function NewWin(url, winHeight, winWidth)
{
    var myWin = window.open(url, "NewWin", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,location=no,toolbar=no,menubar=no,resizable=no,top=0,left=0");
	myWin.focus();
}

function NewResizableWin(url, winHeight, winWidth)
{
    var myWin = window.open(url, "NewWin", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,location=no,toolbar=no,menubar=no,resizable=yes,top=0,left=0");
	myWin.focus();
}

function NewResizableWindow(url, winHeight, winWidth)
{
    var myWin = window.open(url, "NewWin", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,location=yes,toolbar=yes,menubar=yes,resizable=yes,top=0,left=0");
	myWin.focus();
}

function ImagePopUp(url)
{
    var height = 506;
	var width = 400;
	
	var xposition = (screen.width-width)/2;
	var yposition = (screen.height-height)/2;
	
	var argWindow = "width=" + width + ",height=" + height + ",scrollbars=no,location=no,toolbar=no,menubar=no,resizable=no,left=" + xposition + ",top=" + yposition + ",screenx=" + xposition + ",screeny=" + yposition;
	
	var newWindow = window.open( url, "ImagePopUp", argWindow );
	
	if( newWindow )
		newWindow.focus();
}

function VideoPopUp(url)
{
    var height = 400;
	var width = 440;
	
	var xposition = (screen.width-width)/2;
	var yposition = (screen.height-height)/2;
	
	var argWindow = "width=" + width + ",height=" + height + ",scrollbars=no,location=no,toolbar=no,menubar=no,resizable=no,left=" + xposition + ",top=" + yposition + ",screenx=" + xposition + ",screeny=" + yposition;
	
	var newWindow = window.open( url, "VideoPopUp", argWindow );
	
	if( newWindow )
		newWindow.focus();
}

function OpenMaximizedWindow(url)
{
	top.window.moveTo(0,0);
	
	var winHeight, winWidth;

	if (document.all) 
	{
		winHeight = screen.availHeight;
		winWidth = screen.availWidth;
		
		top.window.resizeTo(screen.availWidth, screen.availHeight);
	}
	else if (document.layers||document.getElementById) 
	{
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
		{
			winHeight = screen.availHeight;
			winWidth = screen.availWidth;
		}
	}
	
	var myWin = window.open(url, "NewWin", "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,location=yes,toolbar=yes,menubar=yes,resizable=yes,status=yes,top=0,left=0");

	myWin.resizeTo(winWidth, winHeight);
	myWin.focus();
}


var num=0;

function checkLoad() 
{   
    allImagesLoaded = true;
     for (i = 0; i <= preImages.length-1; i++) 
     {
          if (!preImages[i].complete) 
          {
            allImagesLoaded = false;
          }
     }

   if (allImagesLoaded==false)
   {
        
      //setTimeout("checkLoad()",10) ;
   }
   else
   {
      //document.getElementById("test2").style.visibility="visible";
      //document.getElementById("test2").style.filter="alpha(opacity=0)";
      initialize();
      //alert('initialize');
   }
}


/*POPUP*/
$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

//Added by Yogesh Expand Collapse

$(document).ready(function() {
	 
	//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
	$('.accordionButton').click(function() {

		//REMOVE THE ON CLASS FROM ALL BUTTONS
		$('.accordionButton').removeClass('on');
		  
		//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
	 	$('.accordionContent').slideUp('normal');
   
		//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
		if($(this).next().is(':hidden') == true) {
			
			//ADD THE ON CLASS TO THE BUTTON
			$(this).addClass('on');
			  
			//OPEN THE SLIDE
			$(this).next().slideDown('normal');
		 } 
		  
	 });
	  
	
	/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
	$('.accordionButton').mouseover(function() {
		$(this).addClass('over');
		
	//ON MOUSEOUT REMOVE THE OVER CLASS
	}).mouseout(function() {
		$(this).removeClass('over');										
	});
	
	/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	
	/********************************************************************************************************************
	CLOSES ALL S ON PAGE LOAD
	********************************************************************************************************************/	
	$('.accordionContent').hide();

});

/********tab****************/

    $(function() {

        $('#container-1').tabs();
        $('#container-2').tabs(2);
        $('#container-3').tabs({ fxSlide: true });
        $('#container-4').tabs({ fxFade: true, fxSpeed: 'fast' });
        $('#container-5').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' });
        $('#container-6').tabs({
            fxFade: true,
            fxSpeed: 'fast',
            onClick: function() {
                alert('onClick');
            },
            onHide: function() {
                alert('onHide');
            },
            onShow: function() {
                alert('onShow');
            }
        });
        $('#container-7').tabs({ fxAutoHeight: true });
        $('#container-8').tabs({ fxShow: { height: 'show', opacity: 'show' }, fxSpeed: 'normal' });
        $('#container-9').tabs({ remote: true });
        $('#container-10').tabs();
        $('#container-11').tabs({ disabled: [3] });

        $('<p><a href="#">Disable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
            $(this).parents('div').eq(1).disableTab(3);
            return false;
        });
        $('<p><a href="#">Activate third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
            $(this).parents('div').eq(1).triggerTab(3);
            return false;
        });
        $('<p><a href="#">Enable third tab<\/a><\/p>').prependTo('#fragment-28').find('a').click(function() {
            $(this).parents('div').eq(1).enableTab(3);
            return false;
        });

    });
