$(function() {
//Load Maps Links
$('#Cambridge').click(function (e) {
    e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').html('<iframe width="100%" height="550" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=canada+steel+cambridge&amp;aq=&amp;sll=49.891235,-97.15369&amp;sspn=40.713058,93.603516&amp;vpsrc=6&amp;ie=UTF8&amp;hq=canada+steel&amp;hnear=Cambridge,+Waterloo+Regional+Municipality,+Ontario&amp;ll=43.406082,-80.332912&amp;spn=0.097814,0.040666&amp;t=m&amp;output=embed"></iframe><br /><small><a href="http://www.google.ca/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=canada+steel+cambridge&amp;aq=&amp;sll=49.891235,-97.15369&amp;sspn=40.713058,93.603516&amp;vpsrc=6&amp;ie=UTF8&amp;hq=canada+steel&amp;hnear=Cambridge,+Waterloo+Regional+Municipality,+Ontario&amp;ll=43.406082,-80.332912&amp;spn=0.097814,0.040666&amp;t=m" style="color:#0000FF;text-align:left">View Larger Map</a></small>');
    $('#mapcontent').fadeToggle("medium", function() { });
    });

$('#Goderich').click(function (e) {
    e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').html('<iframe width="100%" height="550px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+Goderich&amp;aq=&amp;sll=43.406045,-80.333061&amp;sspn=0.21675,0.32238&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=Goderich,+Huron+County,+Ontario&amp;t=m&amp;cid=2865841433731247127&amp;ll=43.735445,-81.697683&amp;spn=0.029768,0.054932&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://www.google.ca/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+Goderich&amp;aq=&amp;sll=43.406045,-80.333061&amp;sspn=0.21675,0.32238&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=Goderich,+Huron+County,+Ontario&amp;t=m&amp;cid=2865841433731247127&amp;ll=43.735445,-81.697683&amp;spn=0.029768,0.054932&amp;z=14&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>');
    $('#mapcontent').fadeToggle("medium", function() { });
    });

$('#London').click(function (e) {
    e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').html('<iframe width="100%" height="550px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+London&amp;aq=&amp;sll=43.742329,-81.69528&amp;sspn=0.053886,0.080595&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=London,+Middlesex+County,+Ontario&amp;t=m&amp;cid=13187412769205198061&amp;ll=43.040414,-81.149654&amp;spn=0.060222,0.109863&amp;z=13&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://www.google.ca/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+London&amp;aq=&amp;sll=43.742329,-81.69528&amp;sspn=0.053886,0.080595&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=London,+Middlesex+County,+Ontario&amp;t=m&amp;cid=13187412769205198061&amp;ll=43.040414,-81.149654&amp;spn=0.060222,0.109863&amp;z=13&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>');
    $('#mapcontent').fadeToggle("medium", function() { });
    });

$('#HeadOffice').click(function (e) {
    e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').html('<iframe width="100%" height="550px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+London&amp;aq=&amp;sll=43.742329,-81.69528&amp;sspn=0.053886,0.080595&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=London,+Middlesex+County,+Ontario&amp;t=m&amp;cid=13187412769205198061&amp;ll=43.040414,-81.149654&amp;spn=0.060222,0.109863&amp;z=13&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://www.google.ca/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+London&amp;aq=&amp;sll=43.742329,-81.69528&amp;sspn=0.053886,0.080595&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=London,+Middlesex+County,+Ontario&amp;t=m&amp;cid=13187412769205198061&amp;ll=43.040414,-81.149654&amp;spn=0.060222,0.109863&amp;z=13&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>');
    $('#mapcontent').fadeToggle("medium", function() { });
    });

$('#Sarnia').click(function (e) {
    e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').html('<iframe width="100%" height="550550pxpx" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+Sarnia&amp;aq=&amp;sll=43.005149,-81.182098&amp;sspn=0.10909,0.16119&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=Sarnia,+Lambton+County,+Ontario&amp;t=m&amp;cid=5965652084208692906&amp;ll=42.96195,-82.359352&amp;spn=0.120598,0.219727&amp;z=12&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://www.google.ca/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Canada+Steel+Sarnia&amp;aq=&amp;sll=43.005149,-81.182098&amp;sspn=0.10909,0.16119&amp;vpsrc=6&amp;ie=UTF8&amp;hq=Canada+Steel&amp;hnear=Sarnia,+Lambton+County,+Ontario&amp;t=m&amp;cid=5965652084208692906&amp;ll=42.96195,-82.359352&amp;spn=0.120598,0.219727&amp;z=12&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>');
    $('#mapcontent').fadeToggle("medium", function() { });
    });

$('a[href*="company"]').click(function (e) {
   e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').load('tabs.html #companyprofile');
    $('#mapcontent').fadeToggle("medium", function() { });
});

$('a[href*="beamchart"]').click(function (e) {
   e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').load('onestory.html');
    $('#mapcontent').fadeToggle("medium", function() { });
});

$('a[href*="products"]').click(function (e) {
   e.preventDefault();
    $('#mapcontent').fadeToggle("medium", function() { });
        $('#mapcontent').load('tabs.html #products');
    $('#mapcontent').fadeToggle("medium", function() { });
});

var imgArr = new Array( // relative paths of images
 
 '../images/pic02.jpg',
 '../images/pic03.jpg',
 '../images/pic04.jpg',
 '../images/pic05.jpg',
 '../images/pic06.jpg',
 '../images/pic07.jpg',
 '../images/pic08.jpg',
 '../images/pic09.jpg',
 '../images/pic10.jpg',
 '../images/pic11.jpg',
 '../images/pic12.jpg',
 '../images/pic13.jpg',
 '../images/pic14.jpg',
 '../images/pic15.jpg',
 '../images/pic16.jpg'
 );
 
 var preloadArr = new Array();
 var i;
 
 /* preload images */
 for(i=0; i < imgArr.length; i++){
 preloadArr[i] = new Image();
 preloadArr[i].src = imgArr[i];
 }
 
 var currImg = 1;
 var intID = setInterval(changeImg, 4000);
 
 /* image rotator */
 function changeImg(){
 $('#mast-head').animate({opacity: 0}, 1000, function(){
 $(this).css('background','url(' + preloadArr[currImg++%preloadArr.length].src +') top center no-repeat');
 }).animate({opacity: 1}, 1000);
 }


//Twitter Integration
$('#csscTwitter').jTweetsAnywhere({
    username: 'CanadaSteelServ',
    count: 6,
    showFollowButton: true
    });
    
	//ACCORDION BUTTON ACTION	
	$('div.accordianButton').click(function() {
		$('div.accordianContent').slideUp('normal');	
		$(this).next().slideDown('normal');
	});
 
	//HIDE THE DIVS ON PAGE LOAD	
	$("div.accordionContent").hide();
	$("#visible").show();

});
