﻿// JScript File

$(document).ready(function(){

    $("mainGalleryObject a").each(function(){
        $("bigElement").html(
            
        );
    });
    
    
    $(function(){
   $("#nav li:last-child").css("border","0px solid #b5b5b5")
})

    
});

function initMenu(openIndex) {
 
        $('#VMenu ul:not(.current)').hide();
        
        //$('#VMenu ul:first').show();
         
        $('#VMenu li a').click(
         
        function() {
            var checkElement = $(this).next();
            if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                $('#VMenu ul:visible').slideUp('normal');
                return false;
                }
         
            if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                $('#VMenu ul:visible').slideUp('normal');
                checkElement.slideDown('normal');
            return false;
            }
        }
    );
}

function InitTopMenu()
{
    $(document).ready(function(){   
  
    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)   
  
    $("ul.topnav li span").click(function() { //When trigger is clicked...   
  
        //Following events are applied to the subnav itself (moving subnav up and down)   
        $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click   
  
        $(this).parent().hover(function() {   
        }, function(){   
            $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up   
        });   
  
        //Following events are applied to the trigger (Hover events for the trigger)   
        }).hover(function() {   
            $(this).addClass("subhover"); //On hover over, add class "subhover"   
        }, function(){  //On Hover Out   
            $(this).removeClass("subhover"); //On hover out, remove class "subhover"   
    });   
  
});  
}


function trim(strText) 
{    
while('' + strText.charAt(0) == ' ') 
{      
  strText = strText.substring(1, strText.length);  
    }    
while('' + strText.charAt(strText.length-1)==' ') {        
strText = strText.substring(0, strText.length-1);    }   
return strText;
}

function SearchKeyword()
{

    var searchKeyword="";
     searchKeyword = trim($('#txtSearch').val());
    if(searchKeyword != ""){        
        document.location.href = 'search___' + searchKeyword + '.html';
    }
}
/*
function setFocus(e)
{

  // var target = document.getElementById('txtSearch');
  //	alert(e.keyCode);
	if(e.keyCode=='13')
	{
//	alert('cccc');
		SearchKeyword();
		
		}
}*/

/*
function Search() 
{
    if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
    {
        $('#SearchButton').click();
        return false;
    }
    return true;
}
*/

function InitMapTable()
{
    if(!('.Continent').length > 0)
        return;

    $('.Continent').hide();
    $('.country').hide();
}

function showTable(country)
{
    if(!('.Continent').length > 0)
        return;

    $('.Continent').hide();
    $('.country').hide();
    $('.Continent a').each(function(){
     //alert($(this).attr('name'));
     if($(this).attr('name') == country)
     {
        //$.prettyPhoto.open($(this).closest('.Continent'),'Title','Description');
        $('#inline-1').html($(this).closest('.Continent'));
        $(this).closest('.Continent').show();
        $(this).closest('.country').show();
        $('#aPopupOpen').click();
     }
    });
}


function InittblSupport()
{
    $('.tblSupport a').each(function(){
        $(this).hover(function(){
            $(this).parent().parent().find('td').css('color','#0054b1');
        },function(){
            $(this).parent().parent().find('td').css('color','#5a5a5a');
        });
    });
}


function WriteFlashObj(sSrc, sWidth, sHeight, bTrans, sFlashVars, sID) {
    var sObj = "";
    var sWMode = "";
    var sObjID = sSrc.replace(".swf", "");
    var sVars = "";
    var sPrfx = "?";
    if (sFlashVars) {
        sVars = sFlashVars;
    }
    if (sID) {
        sObjID = sID;
    } else {
        sObjID = sSrc.replace(".swf", "");
    }
    sObj = sObj + "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' width='" + sWidth + "' height='" + sHeight + "' id='" + sObjID + "' align='middle' VIEWASTEXT>";
    sObj = sObj + "<param name='allowScriptAccess' value='sameDomain' />";
    sObj = sObj + "<param name='movie' value='" + sSrc + "' />";
    sObj = sObj + "<param name='quality' value='high' />";
    sObj = sObj + "<param name='bgcolor' value='#ffffff' />";
    sObj = sObj + "<param name='flashvars' value='" + sVars + "' />";
    if (bTrans == true) {
        sObj = sObj + "<PARAM NAME='WMode' VALUE='Transparent'>";
        sWMode = "wmode='transparent'";
    }
    sObj = sObj + "<embed src='" + sSrc + "' flashvars='" + sVars + "' quality='high' bgcolor='#ffffff' " + sWMode + " width='" + sWidth + "' height='" + sHeight + "' ID='" + sObjID + "' NAME='bg' align='middle' allowScriptAccess='sameDomain' swLiveConnect=true ID='bg' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
    sObj = sObj + "</object>";
    DocumentWrite(sObj);

}

function DocumentWrite(sHtml) {
    document.writeln(sHtml);
}

function InitGallery()
{
    if($(".ImageGallery").length > 0)
    {
        $(".ImageGallery a").attr("rel","prettyPhoto[gallery1]");
        $(".ImageGallery a").each(function(){
                $(this).attr('href',$(this).attr('href'));
        });
        $(".ImageGallery a[rel^='prettyPhoto']").prettyPhoto({ theme: 'facebook' });
    }
    if ($(".ImageVideo").length > 0)
        $(".ImageVideo").prettyPhoto({ theme: 'facebook', callback: function() { $('#pp_full_res').html(''); } });
        
    if ($(".ImageEnlarge").length > 0)
        $(".ImageEnlarge").prettyPhoto({ theme: 'facebook' });
    if ($(".InlinePopup").length > 0)
        $(".InlinePopup").prettyPhoto({ theme: 'facebook', default_width: 300 });

    if ($(".FlashPop").length > 0)
        $(".FlashPop").prettyPhoto({ theme: 'facebook' });


}


function Clickheretoprint()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("print_content").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open();
   docprint.document.write("<html><head><title>Inel Power System</title><link href='innerData/printcss/Printstyle.css' rel='stylesheet' type='text/css' />"); 
   docprint.document.write('</head><body onLoad="self.print()">');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus();
}

function PrintById(elm)
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=850, height=400, left=100, top=25";
      var content_vlue = document.getElementById(elm).innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open();
   docprint.document.write("<html><head><title>Inel Power System</title><link href='innerData/printcss/Printstyle.css' rel='stylesheet' type='text/css' />"); 
   docprint.document.write('</head><body onLoad="self.print()">');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus();
}
function printimage(src) {

   // alert(popup2);
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
   //   var content_vlue = document.getElementById(popup2).innerHTML;
      var content_vlue = "<img src=" + src + ">";
     
  var docprint=window.open("","",disp_setting); 
   docprint.document.open();
   docprint.document.write("<html><head><title>Inel Power System</title><link href='innerData/printcss/Printstyle.css' rel='stylesheet' type='text/css' />"); 
   docprint.document.write('</head><body onLoad="self.print()">');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus();

}


