//first detect browser block
/* var mine = window.open('','','width=0,height=0,left=0,top=0,scrollbars=no');
 if(mine)
    var popUpsBlocked = false
 else
    var popUpsBlocked = true
 mine.close()
*/
 // Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.

// initialize a variable to test for JavaScript 1.1.
// which is necessary for the window.location.replace method
var javascriptVersion1_1 = false;

                                 
javascriptVersion1_1 = true;

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;


function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(javascriptVersion1_1) {
    window.location.replace(daURL);
    } else {
    window.location = daURL;
    }
    return;
}

function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) || 
    (!pluginFound && !redirectIfFound)) ) {
    // go away
    goURL(redirectURL);
    return pluginFound;
    } else {
    // stay here and return result of plugin detection
    return pluginFound;
    }    
}

function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
    return true;
    } else {
    return false;
    }
}

function detectFlash(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Shockwave','Flash'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
    pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectDirector(redirectURL, redirectIfFound) { 
    pluginFound = detectPlugin('Shockwave','Director'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
    pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectQuickTime(redirectURL, redirectIfFound) {
     pluginFound = detectPlugin('QuickTime');       
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
    pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
    pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
               detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
               detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }    
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
    pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
    var pluginsArrayLength = navigator.plugins.length;
    // for each plugin...
    for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
        // loop through all desired names and check each against the current plugin name
        var numFound = 0;
        for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
        // if desired plugin name is found in either plugin name or description
        if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
            (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
            // this name was found
            numFound++;
        }   
        }
        // now that we have checked all the required names against this one plugin,
        // if the number we found matches the total number provided then we were successful
        if(numFound == daPlugins.length) {
        pluginFound = true;
        // if we've found the plugin, we can stop looking through at the rest of the plugins
        break;
        }
    }
    }
    return pluginFound;
} // detectPlugin


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}
  
 
 
 function displayFullScreen(saltname){
           var mine = window.open("/full/"+saltname, 'FullScreenPanorama', ',type=fullWindow,fullscreen,scrollbars=auto');
           if(!mine){
                  alert ("Popup window is being blocked in your browser. Please enable it first so as to view the panorama in fullscreen mode.");  
           }
               
           }

function bIE(){
    var browsername=navigator.appName;
    if(browsername=="Netscape"){
        return false;
    }else{
        return true;
    }
}

 function displayreport(val){
            
              if(bIE()){
                         document.getElementById(val).style.display=""; 
              }else{
                         Effect.BlindDown(val);
              } 
         }


function checkMail(email)
{
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(email)) 
    {
        return true;
    }else{
        return false;
    }                
}

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
    return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
    return stringToTrim.replace(/\s+$/,"");
}

function getScreenWidth(){
                var x,y;
                if (self.innerHeight) // all except Explorer
                {
                    x = self.innerWidth;
                    y = self.innerHeight;
                }
                else if (document.documentElement && document.documentElement.clientHeight)
                    // Explorer 6 Strict Mode
                {
                    x = document.documentElement.clientWidth;
                    y = document.documentElement.clientHeight;
                }
                else if (document.body) // other Explorers
                {
                    x = document.body.clientWidth;
                    y = document.body.clientHeight;
                }
                return x;
}

function getScreenHeight(){
             var x,y;
                if (self.innerHeight) // all except Explorer
                {
                    x = self.innerWidth;
                    y = self.innerHeight;
                }
                else if (document.documentElement && document.documentElement.clientHeight)
                    // Explorer 6 Strict Mode
                {
                    x = document.documentElement.clientWidth;
                    y = document.documentElement.clientHeight;
                }
                else if (document.body) // other Explorers
                {
                    x = document.body.clientWidth;
                    y = document.body.clientHeight;
                }
                return y;
}






function checkPostCodeValidity(postcode,countryName)

  {  
        if(countryName=="CA")

        {   

            postcode=postcode.replace(" ","");

            var regPatern=/^\D{1}\d{1}\D{1}\-?\d{1}\D{1}\d{1}$/;

            if(regPatern.test(postcode))

            {                

                    postcode=postcode.substr(0,3)+" "+postcode.substr(3,3);

                    return postcode.toUpperCase();

            }else

            {

                    return false;

            }

        }

        
        if(countryName=="CN")

        {

            var regPatern=/^\d{6,6}$/;

            if(regPatern.test(postcode))

            {     

                     return postcode.toUpperCase();   

            }else

            {

                    return false;

            }

        }
        

        if(countryName=="US")

        {

            var regPatern=/(^\d{5,5}$)|(^\d{5}-\d{4}$)/;

            if(regPatern.test(postcode))

            {     

                     return postcode.toUpperCase();   

            }else

            {

                    return false;

            }

        }

        

         if(countryName=="AU")

        {

            var regPatern=/(^\d{3,4}$)/;

            if(regPatern.test(postcode))

            {     

                     return postcode.toUpperCase();   

            }else

            {

                    return false;

            }

        }

        

        if(countryName=="GB")

        {

                

                 // Permitted letters depend upon their position in the postcode.

                  var alpha1 = "[abcdefghijklmnoprstuwyz]";                       // Character 1

                  var alpha2 = "[abcdefghklmnopqrstuvwxy]";                       // Character 2

                  var alpha3 = "[abcdefghjkstuw]";                                // Character 3

                  var alpha4 = "[abehmnprvwxy]";                                  // Character 4

                  var alpha5 = "[abdefghjlnpqrstuwxyz]";                          // Character 5





                  // Array holds the regular expressions for the valid postcodes

                  var pcexp = new Array ();



                  // Expression for postcodes: AN NAA, ANN NAA, AAN NAA, and AANN NAA

                  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1,2})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));



                  // Expression for postcodes: ANA NAA

                  pcexp.push (new RegExp ("^(" + alpha1 + "{1}[0-9]{1}" + alpha3 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));



                  // Expression for postcodes: AANA  NAA

                  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1}" + alpha4 +"{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));



                  // Exception for the special postcode GIR 0AA

                  pcexp.push (/^(GIR)(\s*)(0AA)$/i);



                  // Standard BFPO numbers

                  pcexp.push (/^(bfpo)(\s*)([0-9]{1,4})$/i);



                  // c/o BFPO numbers

                  pcexp.push (/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);



                  // Load up the string to check

                  var postCode = postcode;



                  // Assume we're not going to find a valid postcode

                  var valid = false;



                      // Check the string against the types of post codes

                      for ( var i=0; i<pcexp.length; i++) {

                        if (pcexp[i].test(postCode)) {



                          // The post code is valid - split the post code into component parts

                          pcexp[i].exec(postCode);



                          // Copy it back into the original string, converting it to uppercase and

                          // inserting a space between the inward and outward codes

                          postCode = RegExp.$1.toUpperCase() + " " + RegExp.$3.toUpperCase();



                          // If it is a BFPO c/o type postcode, tidy up the "c/o" part

                          postCode = postCode.replace (/C\/O\s*/,"c/o ");



                          // Load new postcode back into the form element

                          valid = true;



                          // Remember that we have found that the code is valid and break from loop

                          break;

                        }

                      }



                      // Return with either the reformatted valid postcode or the original invalid

                      // postcode

                      if (valid) {return postCode;} else return false;

                 

        }

        return postcode;
        

  }
  
  function checkMail(email)
{
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(email)) 
    {
        return true;
    }else{
        return false;
    }                
}



 hs.graphicsDir = '/js/highslide/highslide/graphics/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    hs.outlineType = 'rounded-white';
    hs.fadeInOut = true;
    //hs.dimmingOpacity = 0.75;

    // Add the controlbar
    if (hs.addSlideshow) hs.addSlideshow({
        //slideshowGroup: 'group1',
        interval: 2000,
        repeat: true,
        useControls: true,
        fixedControls: true,
        overlayOptions: {
            opacity: .75,
            position: 'top center',
            hideOnMouseOut: true
        }
    }); 


