//here you place the ids of every element you want.
var ids=new Array('productFeatures','productManuals','productPhotos','productReviews','productVideos','productTellaFriend');
var tabs=new Array('productFeaturestab','productManualstab','productPhotostab','productReviewstab','productVideostab','productTellaFriendtab');

function switchid(id){
	hideallids();
	showdiv(id);
}


function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}
}

function hidediv(id) {
		document.getElementById(id).style.display = 'none';
}


function showdiv(id) {
		document.getElementById(id).style.display = 'block';
}

function switchtab(id){
    hidealltabs();
	showtab(id);
}

function hidealltabs(){
	//loop through the array and hide each element by id
	for (var i=0;i<tabs.length;i++){
		hidetab(tabs[i]);
	}
}

function hidetab(id) {
		document.getElementById(id).style.backgroundPosition = '0px 0px';
}

function showtab(id) {
		document.getElementById(id).style.backgroundPosition = '0px -40px';
}

var pt1 = "http://www.sleeptracker.jp";
var pt2 = "http://www.sound-oasis.jp";
var pt3 = "http://www.stresseraser.jp";
var pt4 = "http://www.miowatch.jp";

function outLink(toURL){
              return "javascript:pageTracker._trackPageview('"+ toURL + "');";
 }

function addTarget(){

    $('a').each(function(){

    var element = $(this).attr('href');

    if(element){
      switch(element){
            case pt1:
                    var toURL="/outbound/www.sleeptracker.jp"
                    $(this).attr("onclick", outLink(toURL));
                    break;
            case pt2:
                    var toURL="/outbound/www.sound-oasis.jp"
                    $(this).attr("onclick", outLink(toURL));
                    break;
            case pt3:
                    var toURL="/outbound/www.stresseraser.jp"
                    $(this).attr("onclick", outLink(toURL));
                    break;
            case pt4:
                    var toURL="/outbound/www.miowatch.jp"
                    $(this).attr("onclick", outLink(toURL));
                    break;
      }   
   }
   });
}

$(addTarget);

