
function modalWin(frame,popupContent){
    // create a modal dialog with the data
    $("#modalWin").modal({
			close: false,
            position: ["8%",],
			overlayId: 'popup-overlay',
			containerId: 'popup-container'
    });

//    src='./prepedgePopup.html';
	$("#iframeContent").html('');
    $("#iframeContent").html('<iframe src="' + frame + '" onload="iframeLoaded(\''+popupContent+'\');" id="loadedIframe" height="1" width="1" frameborder="0" border="0" style="border:0">');
}

$(document).ready(function () {

	$('#filePrepButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup.php#1?q='+rand_no,'popupContent');
		return false;
	});
	$('#finishingButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup.php#2?q='+rand_no,'popupContent');
		return false;
	});
	$('#colorButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup.php#3?q='+rand_no,'popupContent');
		return false;
	});
	$('#cuttingButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup.php#4?q='+rand_no,'popupContent');
		return false;
	});
	$('#tilingButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup.php#5?q='+rand_no,'popupContent');
		return false;
	});

	$('#roicalculatorButton').click(function (e) {
		var rand_no = Math.random() * 10000;
		modalWin('./popups/prepedgePopup2.php','popupContent');
		return false;
	});
	$('#successButton').click(function (e) {
		modalWin('./popups/prepedgePopup3.php','popupContent');
		return false;
	});

	$('#reselLink, .reselLink').click(function (e) {
		modalWin('/popups/resellers.html','popupContent');
		return false;
	});

	$('#reselLink2, .reselLink2').click(function (e) {
		modalWin('./popups/resellers2.html','popupContent');
		return false;
	});


	$('#featureMatrix, .featureMatrix').click(function (e) {
		modalWin('./popups/featureMatrix.html','popupContent');
		return false;
	});



});

function iframeLoaded(popupContent){
    var iframeH=$('#'+popupContent).css("height");
    var iframeW=$('#'+popupContent).css("width");

    $('#loadedIframe').attr("height",iframeH);
    $('#loadedIframe').attr("width",iframeW);
    $('#iframeLoading').hide();
}

