//
// JavaScript Document
//
function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
    }
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function $_GET(name){
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	return results == null ? "" : results[1];
}
function launchVideoPlayer(){
	var w = window.open("/video.php","cohens_video","height=450, width=420, toolbar=0, resizable=0, scrollbars=0");
}
//var language = "";
//
//
layoutPage = function(q_section_id){
	var zipcode = 'zipcode=' + $_GET('zipcode');
	var store_id = 'store_id=' + $_GET('store_id');
	var coupon_id = 'coupon_id=' + $_GET('coupon_id');
	var section_id = 'section_id=' + q_section_id;
	//
	// COMMON FOR PANEL PAGES WITH FLASH BLOCKS
	//
	switch(q_section_id){
		case "appointment" :
		case "coupons" :
		case "home" :
		case "locations" :
			flash('cohens_sidebar', '/files/spanish/flash/cohens_sidebar.swf?' + zipcode + '&' + coupon_id, 245, 526, {});
			break;
	}
	//
	// COMMON FOR HTML INFO PAGES WITH MENU BAR TOP/BOTTOM
	//
	switch(q_section_id){
		case "career" :
		case "franchise" :
		case "group" :
		case "products" :
		case "about" :
		default:
			//flash('menu_bar_top', '/files/flash/menu_bar_top.swf', 736, 22, {});
			//flash('menu_bar_bottom', 'flash/menu_bar_bottom.swf', 736, 22, {});
			break;
	}
	//
	// UNIQUE PAGE SECTIONS
	//
	switch(q_section_id){
		case "appointment" :
			flash('main_content', '/files/spanish/flash/cohens_form.swf?' + zipcode + '&' + store_id + "&" + Math.random(), 488, 526, {});
			break;
		case "coupons" :
			flash('main_content', '/files/spanish/flash/coupons.swf?' + coupon_id, 488, 526, {});
			break;
		case "franchise" :
			flash('sidebar_anim', '/files/spanish/flash/franchise_anim.swf', 245, 526, {});
			//flash('submit_button_div','flash/submit_button.swf?js=submitFranchise',80,40,{wmode:"transparent"});
			break;
		case "home" :
			flash('main_content', '/files/spanish/flash/main_content.swf', 488, 145, {});
			break;
		case "locations" :
			flash('main_content', '/files/spanish/flash/locations.swf?' + zipcode, 488, 526, {});
			break;
		case "video" :
			//flash('flash_video', 'flash/video.swf', 488, 378, {});
			//flash('main_content', 'flash/main_content.swf', 488, 145, {});
			flash('main_content', '/files/spanish/flash/video_player.swf', 370, 330, {});
			break;
	}
}