﻿//Temp file to aid in load time until JS can be better incorporated
var sitePlanCurrent = 'null';
var sitePlanFuture = 'null';
var sitePlanInterval;
var leasingPlanCurrent = 'null';
var leasingPlanFuture = 'null';
var leasingPlanInterval;

var gupID = gup("id");

function sitePlanLoadedCheck(){
    if(sitePlanCurrent !== 'null' && sitePlanFuture !== 'null'){
      clearInterval(sitePlanInterval);
    	if(sitePlanCurrent !== ' ' && sitePlanFuture !== ' '){
    		$('.sitePlanContainer').html('<a href="javascript:;" class="sitePlanCurrent">Current</a> | <a href="javascript:;" class="sitePlanFuture">Future</a>');
    	}else if(sitePlanCurrent !== ' ' && sitePlanFuture === ' '){
    		$('.sitePlanContainer').html('<a href="javascript:;" class="sitePlanCurrent">Current</a>');
    	}else if(sitePlanCurrent === ' ' && sitePlanFuture !== ' '){
    		$('.sitePlanContainer').html('<a href="javascript:;" class="sitePlanFuture">Future</a>');
    	}
    	
    	$(".sitePlanCurrent").qtip({
    		content: sitePlanCurrent,
    		style: {
    			name: 'blue',
    			width: 500
    		},
    		position: {
    			corner: {
    				target: 'rightMiddle',
    				tooltip: 'leftBottom'
    			},
    			adjust: {
    				x: 10
    			}
    		},
    		hide: {
    			fixed: true,
    			delay: 1000
    		}
    	});
    	
    	$(".sitePlanFuture").qtip({
    		content: sitePlanFuture,
    		style: {
    			name: 'blue',
    			width: 500
    		},
    		position: {
    			corner: {
    				target: 'rightMiddle',
    				tooltip: 'leftBottom'
    			},
    			adjust: {
    				x: 10
    			}
    		},
    		hide: {
    			fixed: true,
    			delay: 1000
    		}
    	});
    	
    }
}

function leasingPlanLoadedCheck(){
    if(leasingPlanCurrent !== 'null' && leasingPlanFuture !== 'null'){
      clearInterval(leasingPlanInterval);
    	if(leasingPlanCurrent !== ' ' && leasingPlanFuture !== ' '){
    		$('.leasingPlanContainer').html('<a href="javascript:;" class="leasingPlanCurrent">Current</a> | <a href="javascript:;" class="leasingPlanFuture">Future</a>');
    	}else if(leasingPlanCurrent !== ' ' && leasingPlanFuture === ' '){
    		$('.leasingPlanContainer').html('<a href="javascript:;" class="leasingPlanCurrent">Current</a>');
    	}else if(leasingPlanCurrent === ' ' && leasingPlanFuture !== ' '){
    		$('.leasingPlanContainer').html('<a href="javascript:;" class="leasingPlanFuture">Future</a>');
    	}
    	
    	$(".leasingPlanCurrent").qtip({
    		content: leasingPlanCurrent,
    		style: {
    			name: 'blue',
    			width: 500
    		},
    		position: {
    			corner: {
    				target: 'rightMiddle',
    				tooltip: 'leftBottom'
    			},
    			adjust: {
    				x: 10
    			}
    		},
    		hide: {
    			fixed: true,
    			delay: 1000
    		}
    	});
    	
    	$(".leasingPlanFuture").qtip({
    		content: leasingPlanFuture,
    		style: {
    			name: 'blue',
    			width: 500
    		},
    		position: {
    			corner: {
    				target: 'rightMiddle',
    				tooltip: 'leftBottom'
    			},
    			adjust: {
    				x: 10
    			}
    		},
    		hide: {
    			fixed: true,
    			delay: 1000
    		}
    	});
    	
    }
}

$(document).ready(function() {
    $("#ctl00_cphBody_imgMallHeader").css.height="163";
    $("ul.iconlist li#maintrequest").css.zIndex="-1";
    $("div.slide").bgiframe({ src: "BLOCKED SCRIPT'&lt;html&gt;&lt;/html&gt;';" });
    $("div.bizOverlay3").bgiframe({ src: "BLOCKED SCRIPT'&lt;html&gt;&lt;/html&gt;';" });
    $("#siteplan").qtip({ content: 'Web Site Plan', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#leaseplan").qtip({ content: 'Web Lease Plan', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#factsheet").qtip({ content: 'Property Fact Sheet', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#photography").qtip({ content: 'Property Photographs', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#sitelist").qtip({ content: 'Retailers', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#tenantinfo").qtip({ content: 'Tenant Info Package', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#leasinginquiry").qtip({ content: 'Complete a Leasing Program inquiry form today!', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#taxbills").qtip({ content: 'Property Tax Bills', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#maintrequest").qtip({ content: 'Make a maintenance request.', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#promovideo").qtip({ content: 'Promotional Videos', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#mktresearch").qtip({ content: 'Market Research', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#faq").qtip({ content: 'Frequently Asked Questions', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#energy").qtip({ content: 'Energy', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#facility").qtip({ content: 'Facility Operations', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#security").qtip({ content: 'Security', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#procurement").qtip({ content: 'Procurement', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#interactivesiteplan").qtip({ content: 'Interactive Site Plan', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#step").qtip({ content: 'Short-Term Entrepreneurial Package', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
    $("#leasinginquiry").qtip({ content: 'Complete a Leasing Program inquiry form today!', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } });
  
    /* Local Leasing PDF Links
    Options are LEASING_PLAN, FLEASING_PLAN, SITE_PLAN, FSITE_PLAN in lowercase
    ex. http://dev3.simon-ops.com/ajax/mall/getmallplans.ashx?id=176&filetype=leasing_plan
    ---------------------------------------------------	*/
    if($('.sitePlanContainer').length > 0){
    	$.ajax({
    	    url: '/ajax/mall/getmallplans.ashx?filetype=site_plan&id=' + gupID,
    	    cache: true,
    	    success: function(html){
    	    	sitePlanCurrent = html;
    	    	//sitePlanLoadedCheck();
    	    }
    	});
    	
    	
    	$.ajax({
    	    url: '/ajax/mall/getmallplans.ashx?filetype=fsite_plan&id=' + gupID,
    	    cache: true,
    	    success: function(html){
    	    	sitePlanFuture = html;
    	    	//sitePlanLoadedCheck();
    	    }
    	});
    	
    	sitePlanInterval = setInterval('sitePlanLoadedCheck()',500);
    	
    }
    
    if($('.leasingPlanContainer').length > 0){
    	$.ajax({
    	    url: '/ajax/mall/getmallplans.ashx?filetype=leasing_plan&id=' + gupID,
    	    cache: true,
    	    success: function(html){
    	    	leasingPlanCurrent = html;
    	    	//leasingPlanLoadedCheck();
    	    }
    	});
    	
    	$.ajax({
    	    url: '/ajax/mall/getmallplans.ashx?filetype=fleasing_plan&id=' + gupID,
    	    cache: true,
    	    success: function(html){
    	    	leasingPlanFuture = html;
    	    	//leasingPlanLoadedCheck();
    	    }
    	});
    	
    	leasingPlanInterval = setInterval('leasingPlanLoadedCheck()',500);
    }
});
