
$(document).ready(function() {
   		
	$("#content p:first").addClass('intro');
	
	$("#newsCar").easySlider({
		speed: 1,
		nextId: "newsCarNext",
		prevId: "newsCarPrev",
		continuous: true
	});
	
	$("#sitesCar").easySlider({
		speed: 1,
		nextId: "sitesCarNext",
		prevId: "sitesCarPrev",
		continuous: true
	});
	
	//$('#history').tabs();

});


$(function()
		{
			// Call stylesheet init so that all stylesheet changing functions 
			// will work.
			$.stylesheetInit();
			
			// When one of the styleswitch links is clicked then switch the stylesheet to
			// the one matching the value of that links rel attribute.
			$('.styleswitch').bind(
				'click',
				function(e)
				{
					$.stylesheetSwitch(this.getAttribute('rel'));
					return false;
				}
			);
		}
	);


/* Load the dialog on top of the page if the user hasn't seen it in this session. 

 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *


*/
function loadDialog() {
  var cookieName = 'iNovaPharmaDialogViewed';
  var cookieData = $.cookie(cookieName);
  if (cookieData==null||cookieData!='true') {
    //show the dialog - then set a cookie
    $('body').append('<div id="infoDiag"><p>The products on this website are something something Australian visitors only, something something something.</p></div>');
    $("#infoDiag").dialog({ 
      height:200,
      width:300,
      title:'<h2>Information for our visitors</h2>',
      modal: true,
      //show:'slideIn',
      position:'center',
      overlay: { opacity: 0.5, background: "black" },
      resizable:false,
      draggable:false,
      buttons: { "Ok": function() { $(this).dialog("close"); } }     
    });
    $.cookie(cookieName,'true');
  }
  else{
    return;
  }
}

//localhost key
function load() {
    if(document.getElementById("map") != null) {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(-5.487812,95.804688), 13);
      }
      
        var icon_office = new GIcon();
        icon_office.image = "/images/mapsOfficeIcon.png";
        icon_office.shadow = ""; ///images/mapsOfficeShadow.png
        icon_office.iconSize = new GSize(11, 24);
        //icon_office.shadowSize = new GSize(33, 18);
        icon_office.iconAnchor = new GPoint(8,24);
        icon_office.infoWindowAnchor = new GPoint(5, 1);

        var icon_dist = new GIcon();
        icon_dist.image = "/images/mapsDistributorIcon.png";
        icon_dist.shadow = ""; ///images/mapsOfficeShadow.png
        icon_dist.iconSize = new GSize(11, 24);
        //icon_dist.shadowSize = new GSize(33, 18);
        icon_dist.iconAnchor = new GPoint(8,15);
        icon_dist.infoWindowAnchor = new GPoint(5, 1);
      
        //Australia
	    var latlngAus = new GLatLng(-33.72334,151.081268);
	    var markerAus = new GMarker(latlngAus, icon_office)
	    var infoAus = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">AUSTRALIA</strong><br />9-15 Chilvers Rd<br />Thornleigh  NSW 2120</div>'
	    map.addOverlay(markerAus);
	    GEvent.addListener(markerAus, 'click', function() {
	        map.openInfoWindowHtml(latlngAus,infoAus);
	    });
    	
	    //New Zealand
	    var latlngNZ = new GLatLng(-36.861905,174.635239);
	    var markerNZ = new GMarker(latlngNZ, icon_dist)
	    var infoNZ = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">NEW ZEALAND</strong><br />Central Park Drive<br />Lincoln Auckland 0610 </div>'
	    map.addOverlay(markerNZ);
	    GEvent.addListener(markerNZ, 'click', function() {
	        map.openInfoWindowHtml(latlngNZ,infoNZ);
	    });
    	
	    //Hong Kong
	    var latlngHK = new GLatLng(22.320225,114.226313);
	    var markerHK = new GMarker(latlngHK, icon_office);
	    var infoHK = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">HONG KONG</strong><br />Unit 01, 20/F, Millennium City 3 <br />370 Kwun Tong Road<br />Kwun Tong Kowloon</div>'
	    map.addOverlay(markerHK);
	    GEvent.addListener(markerHK, 'click', function() {
	        map.openInfoWindowHtml(latlngHK,infoHK);
	    });
    	
	    //Malaysia
	    var latlngMY = new GLatLng(3.080523,101.494789);
	    var markerMY = new GMarker(latlngMY, icon_office);
	    var infoMY = '<div style="font-family: Arial; font-size: 11px; line-height: 130%"><strong style="font-size: 12px">MALAYSIA</strong><br />Level 5, Wisma Samudra<br /> No. 1, Jalan Kontraktor U1/14<br />Hicom-Glenmarie Ind. Park<br />40150 Shah Alam</div>'
	    map.addOverlay(markerMY);
	    GEvent.addListener(markerMY, 'click', function() {
	        map.openInfoWindowHtml(latlngMY,infoMY);
	       });

        //Philippines
	       var latlngPH = new GLatLng(14.556378, 121.021271);
		var markerPH = new GMarker(latlngPH, icon_office)
		var infoPH = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">Philippines</strong><br />Unit 28-B, Ayala Life-FGU Center<br />6811 Ayala Avenue<br /> Makati City 1227</div>'
		map.addOverlay(markerPH);
		GEvent.addListener(markerPH, 'click', function() {
	   		map.openInfoWindowHtml(latlngPH, infoPH);
		});
    	
	    //Singapore
	    var latlngSG = new GLatLng(1.328411,103.897576);
	    var markerSG = new GMarker(latlngSG, icon_office)
	    var infoSG = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">SINGAPORE</strong><br />10 Ubi Crescent<br /># 02-51 Ubi Techpark Lobby C <br /> Singapore 408564</div>'
	    map.addOverlay(markerSG);
	    GEvent.addListener(markerSG, 'click', function() {
	        map.openInfoWindowHtml(latlngSG,infoSG);
	    });
    	
	    //Thailand
	    var latlngThai = new GLatLng(13.7353,100.563011);
	    var markerThai = new GMarker(latlngThai, icon_office)
	    var infoThai = '<div style="font-family: Arial; font-size: 11px; line-height: 130%"><strong style="font-size: 12px">THAILAND</strong><br />50 GMM Grammy Place Building, 12th Floor, Unit B5<br />Sukhumvit 21 Road (Asoke)<br />Klongtoeynua Wattana<br />Bangkok 10110</div>'
	    map.addOverlay(markerThai);
	    GEvent.addListener(markerThai, 'click', function() {
	        map.openInfoWindowHtml(latlngThai,infoThai);
	       });

	   //Taiwan
	       var latlngTW = new GLatLng(25.081443, 121.57587);
       var markerTW = new GMarker(latlngTW, icon_office)
       var infoTW = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">Taiwan</strong><br />10F, No.22, Lane 407, Ti-Ding Blvd <br /> Section 2, Neihu Technology Park <br /> Taipei 114</div>'
       map.addOverlay(markerTW);
       GEvent.addListener(markerTW, 'click', function() {
       	map.openInfoWindowHtml(latlngTW, infoTW);
       });
	    
    	
	    //South Africa
	    var latlngSA = new GLatLng(-33.166654,19.33332);
	    var markerSA = new GMarker(latlngSA, icon_office)
	    var infoSA = '<div style="font-family: Arial; font-size: 11px"><strong style="font-size: 12px">SOUTH AFRICA</strong><br />15e Riley Road<br />Bedfordview 2008</div>'
	    map.addOverlay(markerSA);
	    GEvent.addListener(markerSA, 'click', function() {
	        map.openInfoWindowHtml(latlngSA,infoSA);
	    });		

    	
	    //Other controls
	    map.addControl(new GSmallMapControl());
	    map.setZoom(2)
    }
}

//$(document).ready(Menu.init);
//$(document).ready(load());
