//error handling
//window.onerror = function (err, file, line) {
//    //can be set to alert,hide or default (empty string)
//    var errors = "alert";

//    switch (errors) {
//        case "alert":
//            alert('JavaScript Error: ' + err + '\n' +
//			'In file: ' + file + '\n' +
//			'At line: ' + line);
//            return true;
//            break;
//        case "hide":
//            return true;
//            break;
//        default:
//            return false; //default handler
//    }
//}


//addOnload function allows us to attach multiple functions to window.onload event
//addOnload(functionname())
function addOnload(myfunc) {  
    if (window.addEventListener) {
        window.addEventListener('load', myfunc, false);
    } else if (window.attachEvent) {
        window.attachEvent('onload', myfunc);
    }
}

//images for random picture generator
var homeImages = new Array("/themes/img/home_1.jpg", "/themes/img/home_2.jpg", "/themes/img/home_3.jpg", "/themes/img/home_4.jpg", "/themes/img/home_5.jpg", "/themes/img/home_6.jpg");
//random picture generator
var thisImg = 0;
function choosePics(imgArray) {
    thisImg = Math.floor((Math.random() * imgArray.length));
    alert(thisImg);
    document.getElementById("home").src = imgArray[thisImg];
    //call roatate
    rotate("homeImg");
}

function rotates(imgName) {
	thisImg++;
	if (thisImg == homeImages.length) {
		thisImg = 0;
	}
    document.getElementById(imgName).src = homeImages[thisImg];
    setTimeout(rotate, 3 * 1000);
}



//video playback
function onYouTubePlayerReady(playerId) {
	ytplayer = document.getElementById("video_overlay");
	ytplayer.setVolume(100);
}


//function popUp() {
//  $('.Product_Click').click(function () {
//    $(this).stop();
//    $('.ProductDetails').hide();
//    $(this).parent().find('.back_gray').fadeIn();
//    $(this).parent().find('.ProductDetails').fadeIn();
//  });
//  $('.close').click(function () {
//      $('.back_gray').fadeOut();
//      $('.popup').fadeOut();
//  });
//}
