var tf; 

function rotateFeatured(which){

switch(which){
  case "1" :
  case 1 :
  retrieve_featured_content("featured_listings");
	$("tab2").className = "selected_feature_tab";
	$("tab1").className = "featured_tab";
	$("tab3").className = "featured_tab";
  var next = "2";
  tf = setTimeout('rotateFeatured('+next+')', 15000);
  break;
  case "3" :
  case 3 :
	retrieve_featured_content("users_recommend");
	$("tab2").className = "featured_tab";
	$("tab1").className = "selected_feature_recs";
	$("tab3").className = "featured_tab";
  var next = "1";
  tf = setTimeout('rotateFeatured('+next+')', 15000);
  break;
  case "2" :
  case 2 :
	retrieve_featured_content("new_members");
	$("tab1").className = "featured_tab";
	$("tab2").className = "featured_tab";
	$("tab3").className = "selected_feature_tab";
  var next = "3";
  tf = setTimeout('rotateFeatured('+next+')', 15000);
  break;
}


}


function retrieve_featured_content(wc) {
	var dc = $("featured_city_guide_innercontents");
	var content = null;
	switch(wc) {
		case "featured_listings" :
			content = "featured_listings";
		break;
		case "users_recommend" :
			content = "users_recommend";
		break;
		case "new_members" :
			content = "new_members";
		break;
	}	
	if(content != null) {
		var queryget = "content=" + encodeURIComponent(content);
		var jax = new Ajax.Request('/action/featured.content.php', {
							asynchronous:true, 
							method:'get', 
							parameters:queryget, 
							//onLoading:function() {
							//dc.innerHTML = "<table width=\"100%\" align=\"center\"><tr><td align=\"center\" style=\"padding-top:15px;\"><table align=\"center\"><tr><td> <img src=\"/images/progress_wheel.gif\" /> </td><td class=\"loading_txt\"> Loading... </td></tr></table></td></tr></table>";
							//},
							onSuccess:function(qres) {
							dc.innerHTML = qres.responseText;
							},
							onFailure:function() {
							dc.innerHTML = "<div style=\"color:red;font-weight:bold;font-family:verdana,arial;\">failed</div>";
							}
							}); 
	}
} // END FUNCTION


//Wait Wheel 
function wait_wheel(text) {
	if(text == null) {
		text = "Please Wait...";
	} 
	var html = "<table><tr><td><img src=\"/images/progress_wheel.gif\" border=\"0\" /></td><td style='font-family:vedana,arial;font-size:12px;color:#333333;font-weight:bold;'>"+ text +"</td></tr></table>";
	return html;
}


function cg_1() {
  clearTimeout(tf);
	retrieve_featured_content("featured_listings");
	$("tab2").className = "selected_feature_tab";
	$("tab1").className = "featured_tab";
	$("tab3").className = "featured_tab";
}

function cg_3() {
  clearTimeout(tf);
	retrieve_featured_content("users_recommend");
	$("tab2").className = "featured_tab";
	$("tab1").className = "selected_feature_recs";
	$("tab3").className = "featured_tab";
}

function cg_2() {
  clearTimeout(tf);
	retrieve_featured_content("new_members");
	$("tab1").className = "featured_tab";
	$("tab2").className = "featured_tab";
	$("tab3").className = "selected_feature_tab";
}

function whyILikeIt(why_text) {
	$("why_contents").show();
	$("why_i_like_it_text").innerHTML = why_text + "<div style=\"text-align:right;\"><a href=\"javascript:closeWhy();\">Close</a></div>";	
}

function closeWhy() {
	$("why_contents").hide();	
}


function check_status_favorites(divbox) {
	$(divbox).hide();
	$(divbox).innerHTML = "";
}

function close_why_favorite(divbox) {
	Effect.toggle(divbox, 'slide');	
}

function favorites_wait_while_loading(divbox) {
	$(divbox).innerHTML = wait_wheel();	
}

function check_favorites_status(status_request, div_favorites_box) {
	$(div_favorites_box).show();
	xhr = status_request.getResponseHeader("Code");
	xcontent = status_request.responseText;
	
	switch(xhr) {
		case "100" :
		case 100 :
			$(div_favorites_box).innerHTML = "<strong>"+ xcontent +"</strong>";
			setTimeout("check_status_favorites('"+div_favorites_box+"')", 6000); 
		break;
		case "150" :
		case 150 :
			setTimeout("check_status_favorites('"+div_favorites_box+"')", 6000); 
		break;
		case "200" :
		case 200 :
			$(div_favorites_box).innerHTML = "<strong>"+ xcontent +"</strong>";
		break;
		case "225" :
		case 225 :
			$(div_favorites_box).innerHTML = "<strong>"+ xcontent +"</strong>";
			setTimeout("check_status_favorites('"+div_favorites_box+"')", 6000); 
		break;
		case "250" :
		case 250 :
			$(div_favorites_box).innerHTML = "<div class=\"xhr_favorites_notsignin\"><strong>"+ xcontent +"</strong></div>";
			setTimeout("check_status_favorites('"+div_favorites_box+"')", 6000); 	
		break;
		case "300" :
		case 300 :
			$(div_favorites_box).innerHTML = "<strong>"+ xcontent +"</strong>";
			setTimeout("check_status_favorites('"+div_favorites_box+"')", 6000); 
		break;
		default :
			$(div_favorites_box).innerHTML = xcontent;
		break;
	}
	
}


function submit_cantfind_business(div_parent_id) {
	var tmp_div_html = $("cantfind_click_btn_div").innerHTML;
	$("cantfind_click_btn_div").innerHTML = wait_wheel();
	
	var f = $("cantfind_form_info").serialize();
	if($("cantfind_business_name").value == "" || $("cantfind_business_name").value.length <= 2) {
		$("cantfind_business_name").style.backgroundColor = "red";	
	}
	if($("cantfind_business_city").value == "" || $("cantfind_business_city").value.length <= 3) {
		$("cantfind_business_city").style.backgroundColor = "red";	
	}
	// WAIT WHEEL 
	if($("cantfind_business_name").value != "" && $("cantfind_business_name").value.length > 2 && $("cantfind_business_city").value != "" && $("cantfind_business_city").value.length > 3) {
	var jax = new Ajax.Request('/action/cantfind_request.php', {asynchronous:true, method:'post', parameters:f, 
								onSuccess:function(qres) {
									$(div_parent_id).innerHTML = "<div style=\"width:273px;overflow:hidden;\">"+ qres.responseText +"</div>";
								},
								onComplete:function() {
									setTimeout("Effect.toggle('"+div_parent_id+"', 'slide')", 8000);
									//$("cantfind_click_btn_div").innerHTML = tmp_div_html;
								}
							});		
	}
}

function onclick_inputbox(input_id) {
	$(input_id).style.backgroundColor = "white";
}

/* AFTER SAVE TO FAVORITE */

function check_favorites_status_after_save(divbox) {
	setTimeout("check_status_favorites('"+ divbox +"')", 3000); 
}


/* FUNCTIONS ADDED BY HAYK START*/
function check_business_name(form) {

  if (form.business_name.value == "") {
    alert( "Please enter the business name you want to search." );
    form.business_name.focus();
    return false ;
  }

  return true ;
	
}
function check_location(form, default_location) {

  if (form.location.value == "") {    
    form.location.value=default_location;
    form.location.focus();   
  }
  return true ;
	
}
/* FUNCTIONS ADDED BY HAYK END*/
function revertErrorWarning() {
	new Effect.Fade("error_warnings");
}
function PleaseSignIn()
{
	$("error_warnings").innerHTML = "<span style='font-size:12px'>Please Sign In</span>";
	$("error_warnings").style.display = "block";
	new Effect.Highlight("error_warnings", {startcolor:"#E71F1F"});
	setTimeout("revertErrorWarning()", 6000);
					
}
function sendFriendRequestProfile(me,userid,message) {
	hideLightBox();
	var o = document.getElementById("error_warnings");
	var replyVar = "user="+encodeURIComponent(userid) + "&message=" + encodeURIComponent(message) + "&me=" + me;
	var jax = new Ajax.Request("./include/profile/friend_request.php", {
				method:"post",
				parameters:replyVar,
				onSuccess:function(qres) {
					if (o != null) 
					{
					 if (qres.responseText!="")
					 {
					  $("error_warnings").innerHTML = "<span style='font-size:12px'>" + qres.responseText + "</span>";
					  $("error_warnings").style.display = "block";
					 }
					 else
					 {
					  $("error_warnings").innerHTML = "<span style='font-size:12px'>Please Sign In</span>";
					  $("error_warnings").style.display = "block";
					 }
					}
					else
					{
					  alert(qres.responseText);
					}
					new Effect.Highlight("error_warnings", {startcolor:"#E71F1F"});
					setTimeout("revertErrorWarning()", 6000);
					$("thedisplay").innerHTML = "Request was sent";
				}
			});
	
}


function BusSendtoPhone ()
{
	
}

/*
*	START : FUNCTIONS FOR TAG LISTINGS
*/
function tagThisBusinessProfile(business) {
		var query = "b="+ encodeURIComponent(business);
		var jax = new Ajax.Request('/action/tag.listing.php', {
							asynchronous:true,  method:'post', parameters:query, 
							onLoading:function() {
								$("taglisting_div").show();
								$("taglisting_div").innerHTML = "<div style=\"margin-bottom:10px;\">"+ wait_wheel() +"</div>";
							},
							onSuccess:function(qres) {
								var statusCode = qres.getResponseHeader("Code");
								$("taglisting_div").innerHTML = "<div>"+ qres.responseText +"</div>";
								if(statusCode == 400) {
									setTimeout("new Effect.toggle('taglisting_div', 'slide')", 6000);
								}
							},
							onFailure:function() {
								$("taglisting_div").innerHTML = "<div style=\"color:red;font-weight:bold;font-family:verdana,arial;\">failed</div>";
							}
						}); 
	// ----
} // END FUNCTION 

/*
*	SAVE THE TAGS
*/
function save_my_tags() {
	var business = $("tag_business_name").value;
	var tags = $("my_tags").value;
	var bid = $('bid').value;
	
	var query = "t="+ encodeURIComponent(tags) +"&bid=" + encodeURIComponent(bid);
	
	var jax = new Ajax.Request('/action/savetag.listing.php', { asynchronous:true,  method:'post', parameters:query, 
					onLoading:function() {
						$("taglisting_div").innerHTML = "<div style=\"margin-bottom:10px;\">"+ wait_wheel() +"</div>";
					},
					onSuccess:function(qres) {
						var statusCode = qres.getResponseHeader("Code");
						$("taglisting_div").innerHTML = qres.responseText;
						if(statusCode == 225) {
							setTimeout("new Effect.toggle('taglisting_div', 'slide')", 6000);	
						}
					},
					onFailure:function() {
						$("taglisting_div").innerHTML = "<div style=\"color:red;font-weight:bold;font-family:verdana,arial;\">failed</div>";
					},
					onComplete:function(qres) {
						
					}
			}); 	
	// ----
} // END FUNCTION 

/*
*	CANCEL, CLOSE THE BOX
*/	
function cancel_my_tags() {
	new Effect.SlideUp("taglisting_div");
} // END FUNCTION

/*
*	END : FUNCTIONS FOR TAG LISTINGS
*/




/*
*	START : FOR BUSIENSS MAP
*/

    var map = null;
    var geocoder = null;

    function initialize(div_idbox, address, businfo) {
      if (GBrowserIsCompatible()) {
	 	  map = new GMap2(document.getElementById(div_idbox));
		  geocoder = new GClientGeocoder();
		  // GEO CODE NEW SPOT
		  geocoder.getLatLng(address,
							  function(point) {
								if (!point) {
								  alert("Could not map: "+ address);
								} else {
								  map.setCenter(point, 13);
								 var marker = new GMarker(point);
								  map.addOverlay(marker);
								  marker.openInfoWindowHtml(businfo);
								} // end if else
							  } // end function callback
        			); // end geocode
		   
      }
    }

    function showAddress(address, businfo) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert("Could not map: "+ address);
			  //alert(address + " not found");
            } else {
			  map.setCenter(point, 13);
             var marker = new GMarker(point);
              map.addOverlay(marker);
			  
              marker.openInfoWindowHtml(businfo);
            }
          }
        );
		
      } // end if
    } // end function
/*
*	END : FOR BUSIENSS MAP
*/

// FUNCTIONS FOR EVENTS 

function EventDateSeriesList (sID)
{
 if ($("EventDates").innerHTML == "")
 {
  $("EventDates").innerHTML = wait_wheel(); 
  var params = "sID=" + encodeURIComponent(sID);
  var jax = new Ajax.Updater("EventDates","./include/SeriesList.php",{ method: 'get', parameters: params });
 }
 else
 {
  $("EventDates").innerHTML = "";
 }
}

function headlineUploadField() 
{
	
 if (document.frmEventSubmit.upload_picture.selectedIndex == 1) 
 {
	 $("FileUpload").innerHTML = "<span class = 'warning_msg_small'>NOTE: A $10 additional charge will apply  <a href='http://' target='_new'>what is this?</a></span><br><br>" +
	 "<div style='margin-left:5px;margin-bottom:10px;'>File Name:    <input type='file' name='billboardpic'></div> ";
 }
 else
 {
	 $("FileUpload").innerHTML = "";
 }
}

function noteBillboard()
{
	if (document.frmEventSubmit.show_billboard.selectedIndex ==1)
	{
		$("billboard_note").innerHTML = "<span class='warning_msg_small'>NOTE: A $35 additional charge will apply  <a href='http://' target='_new'>what is this?</a></span>";
	}
	else
	{
		$("billboard_note").innerHTML = "";
	}
}

function registerEvent(userid,eventID)
{
	$("regresponse").innerHTML = wait_wheel();
	var params = "userid=" + encodeURIComponent(userid) + "&eventID=" + encodeURIComponent(eventID);
	var jax = new Ajax.Updater("regresponse","./layouts/EventRegisterAction.php", { method: 'post', parameters: params });
}


function EventEmailFriend(eventTitle)
{
	var params = "eventTitle="+encodeURIComponent(eventTitle);
	if ($("eventemail").innerHTML == "") 
	{
		var jax = new Ajax.Updater("eventemail","./layouts/emailEvent.php",{ method: 'post', parameters: params });
	}
	else
	{
		$("eventemail").innerHTML = "";
	}
}

function sendEvent()
{
	$("sending").innerHTML = wait_wheel();
	var myname = document.formemail.myname.value;
	var myemail = document.formemail.myemail.value;
	var fname = document.formemail.fname.value;
	var femail = document.formemail.femail.value;
	var message = document.formemail.message.value;
	var params = "myname="+encodeURIComponent(myname)+"&myemail="+encodeURIComponent(myemail)+"&fname="+encodeURIComponent(fname)+"&femail="+encodeURIComponent(femail)+"&message="+encodeURIComponent(message);
	//alert(params);
	var jax = new Ajax.Updater("sending","./layouts/emailEventAction.php", { method: 'post', parameters: params } );
	document.formemail.fname.value = "";
	document.formemail.femail.value = "";
}
function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

// END FUNCTIONS FOR EVENTS

function sendingSMS(theform)
{

var phone = theform.phone1.value + theform.phone2.value + theform.phone3.value;


if(phone.length < 10){
  alert("The phone number provided is incorrect. Please provide a 10 digit number.");
  return false;
} else {

if(IsNumeric(phone) == false){
  alert("The phone number must be numeric values only");
  return false;
} else {
if(theform.carrier.value == ""){
  alert("Please provide your service carrier");
  return false;
} else {

if(theform.agree.checked == false){
 alert("Please agree to our terms and conditions");
 return false; 
} else {

		$("sms_send").innerHTML = wait_wheel();
		
		var busname = encodeURIComponent(theform.busname.value);
		var busphone = encodeURIComponent(theform.busphone.value);
		var busaddress = encodeURIComponent(theform.busaddress.value);
    var carrier = encodeURIComponent(theform.carrier.value);		
		var params = "phone=" + phone + "&carrier=" + carrier + "&busname=" + busname + "&busphone=" + busphone + "&busaddress=" + busaddress;
		var jax = new Ajax.Request("/sendtophoneAction.php", { method: 'post', parameters: params, onComplete: function(qres){
	if (qres.responseText == "OK")
	{
	  $("formdiv").style.display="none";
	  $("sms_back").style.display="";
		$("sms_send").style.display = "none";
		$("sms_back").innerHTML = "Your message was succesfully sent to ("+ theform.phone1.value + ") " + theform.phone2.value + "-" + theform.phone3.value;
		setTimeout("hideLightBox()",5000);	
	}
	else
	{
		$("sms_back").innerHTML = qres.responseText;
	}
	} 
		});
		
		    }
		  }
    }	
  }
}


function feedback_wait() {
	$("feedback_btntd").innerHTML = wait_wheel();	
}

function submit_feedback_form(query_string) {
	
	new Ajax.Request("/action/send.feedback.php", {method:"post", parameters:query_string, 
					 onLoading:function(){ 
					 	feedback_wait();
					}, 
					onSuccess:function() {
						//setTimeout("window.alert('Thank you for your feedback!')", 1000);
					},
					onComplete:function(status_request) {
						xhr = status_request.getResponseHeader("Error");
						xcontent = status_request.responseText;
						setTimeout("window.alert('Thank you for your feedback!')", 1000);
						hideLightBox();	
					}
					});		
}

function redirect_to_samepage() {
	var current_page = new String(window.location);
	window.location = current_page;	
}


// Save tags
function add_new_tags(query_string) {
	var o = window.opener;
	new Ajax.Request('/action/savetag.listing.php', {method:'post', parameters:query_string,
					onLoading:function() {
						$('click_controllers_div').innerHTML = wait_wheel();
					},
					onSuccess:function() {
						
					}, 
					 onComplete:function(request) {
					  $('click_controllers_div').innerHTML = "Your tags have been saved.";					 	
						
						o.location = o.location;
					}});
}	


// Open the Review Guide Lines
function window_open(url) {
	var featured = "width=535,height=600,resizable=no,status=no,scrollbars=yes,toolbar=no,menubar=no,personalbar=no,dialog=no,minimizable=no";
	window.open(url, "review_guidelines", featured);
}


// Business Profile Upload Photos from Desktop
// Photos Uploading Methods
var photos_upload = {
	input_elements : "",
	submit_desktop_photos : function() {
		photos_upload.input_elements = $('upload_btn').innerHTML;
		$('upload_btn').innerHTML = wait_wheel();
		$('photos_from_desktop').submit();
	},
	delete_photo : function(photo, id, state, bid) {
		// remove the photo
		var query = "id=" + encodeURIComponent(id) +"&state=" + encodeURIComponent(state)+"&bid="+ bid;
		new Ajax.Request('/action/delete.user_uploaded_image.php', {
			method : 'post',
			parameters : query,
			onSuccess : function(request) {
				//window.alert(request.responseText);
				if(request.responseText == "ok" || request.responseText == "okok") {
					new Effect.Fade(photo);
				} else {
					//window.alert(request.responseText);
				}
			},
			onFailure : function() {
				window.alert("We were unable to delete your photo, Try Again.");
			}
		});
	}
};


function delete_photo(div_id, id, state, bid) {
	photos_upload.delete_photo(div_id, id, state, bid);
}



//
// Photo Uploading Functions
// Encapsulate the Flickr Methods
//
var flickr = {
	url : "/action/retrieve.flickr.photos.php",
	save_url : "/action/save.flickr.photo.php",
	input_elements : "",
	username : "",
	business_params : "",
	business_upload_url : "",
	number_of_images_selected :  0,
	business_state : "",
	current_selected_images : new Array(),
	retrieve_photos : function(username, business_params, business_id) {
		flickr.username = $('flickr_username').value;
		flickr.business_params = business_params;
		new Ajax.Request(flickr.url, {
			method:'get', 
			parameters:'bid='+ encodeURIComponent(business_id) +'&username='+ encodeURIComponent(username) +"&state="+ encodeURIComponent(flickr.business_state) +"&"+ flickr.business_params,
			onLoading:function() {
				flickr.input_elements = $('flickr_input_elements').innerHTML;
				$('flickr_input_elements').innerHTML = wait_wheel();
				$('upload_selected_div').hide();
				$('upload_selected_div2').hide();
				
				$('flickr_response').innerHTML = "";
			},
			onSuccess:function(request) {
				// Insert the Returned HTML into the div
				$('flickr_response').innerHTML = request.responseText;
				$('upload_selected_div').show();
				$('upload_selected_div2').show();
					
			},
			onComplete:function(request) {
				// When the Request gets Completed we will bring back the input elements
				// That way the user will now the request was completed..
				$('flickr_input_elements').innerHTML = flickr.input_elements;
				$('flickr_username').value = flickr.username;
				
				initialize(); // Initialize the Lightbox
				
			}
		});
	}, // end of Retrieve Photos Method
	// Save Flickr Photos From the Lightbox
	save_flickr_photos : function(query_string) {
		var temp_html = $('upload_selected_div').innerHTML;
		var temp_html2 = $('upload_selected_div2').innerHTML;		
		new Ajax.Request(flickr.save_url, {
			method : 'post',
			parameters : query_string +"&state="+ encodeURIComponent(flickr.business_state),
			onLoading : function(request) {
				$('upload_selected_div').innerHTML = wait_wheel("Please Wait, Uploading Images...");
				$('upload_selected_div2').innerHTML = wait_wheel("Please Wait, Uploading Images...");
			},
			onComplete : function(request) {
				var flickr_response = request.getResponseHeader("Flickr");
				//$('upload_selected_div').innerHTML = temp_html;
				//window.alert(request.responseText);
				//return;
				
				switch(flickr_response) {
					case "ok" :
						setTimeout("flickr.redirect_to(1)", 1);
					break;
					default :
						// There was an error, we need to handle it.
						setTimeout("flickr.redirect_to(0)", 1);
					break;
				}
			}
		});
	}, // end of save_flickr_photos
	redirect_to : function(status) {
		flickr.business_upload_url += "?post=" + status;
		window.location = flickr.business_upload_url;
	},
	checkbox : function(id, image_id) {
		var image_selected = "check_" + image_id;
		var image = $("photo-"+image_id);
		if($(id).checked == true) {
			flickr.update_selected_images("-");
			$(id).checked = false;
			image.className = "flickr-photo";
			
			// Remove the Elements with the id
			flickr.remove_selected_image(image_selected);
			
			return;
		}	
		$(id).checked = true;
		image.className = "flickr-photo-selected";
		flickr.update_selected_images("+");
		flickr.current_selected_images.push(image_selected);
		
	},
	remove_selected_image : function(image_id_to_remove) {
		for(var i=0; i<flickr.current_selected_images.length; i++) {
				// if the currrent element that was de-selected then we will want to 
				// remove it from the array of selected photos
				if(flickr.current_selected_images[i] == image_id_to_remove) {
					flickr.current_selected_images[i] = "";
				}
		}
	},
	update_selected_images : function(how) {
		switch(how) {
			case "+" : flickr.number_of_images_selected += 1;
			break;
			case "-" : flickr.number_of_images_selected -= 1;
			break;
		}
		if(flickr.number_of_images_selected < 0) flickr.number_of_images_selected = 0;
		$('num_selected_images').innerHTML = flickr.number_of_images_selected;
		$('num_selected_images2').innerHTML = flickr.number_of_images_selected;
		
	},
	upload_images : function() {
		var selected_images = document.getElementsByClassName('flickr-photo-selected');
		var query = new Array();
		for(var i=0; i<flickr.current_selected_images.length; i++) {
			if(flickr.current_selected_images[i].length > 2 && flickr.current_selected_images[i] != "") {
				image_selected = "image[]="+ $(flickr.current_selected_images[i]).value;
				query.push(image_selected);
			}
		}
		query = query.join("&").toString();
		
		// Submit the Query String to Save the Flickr Photos
		flickr.save_flickr_photos(query); 
	}
};


function retrieve_flickr_photos(upload_url, business_id, business_state) {
	flickr.business_upload_url = upload_url;
	flickr.business_state = business_state;	
	var business_info = new String($('business_jsinfo').value);	
	flickr.retrieve_photos($('flickr_username').value, business_info, business_id);
}

function save_flickr_photo() {
	var form_data = $('flickr_form_details').serialize();
	flickr.save_flickr_photos(form_data);
	
	var tmp_html = $('flickr_input_elements').innerHTML;
	$('flickr_input_elements').innerHTML = wait_wheel();
}


function check_flickr_box(id, image_id) {
	flickr.checkbox(id, image_id);
}


function open_popwindow(href_id, url) {
  if(url){
    var uri = url;
  }else {
	 var uri = $(href_id).href;
	}
	var window_attr = "width=532,height=435,location=false,scrollbars=false,toolbar=false,menubar=false";
	window.open(uri, href_id, window_attr);
}

function popup_redirect_to_login(href_id, url, business_url) {
	var o = window.opener;
	window.close();
	o.location = url +"?redirect=" + encodeURIComponent(business_url);
	 return false;
}


