var gmarkers = []; var i = 0; var j; var map_movements_listener ="on"; var mouse_over_map ="no"; var map_is_loaded ="no"; var text_thumbs_up = "Thumb up"; var text_thumbs_down = "Thumb down"; var text_thumbs_flag = "Flag as inappropriate"; var are_we_logged_in; var comment_part_1; var comment_part_2; var comment_part_3; var comment_part_4; var our_review_length="0"; var our_review_grade="0"; var our_review_email_length="0"; var our_review_password_length="0"; var our_review_email_at_signs; var our_review_email =""; var password =""; var our_review_password =""; var secure_password =""; var forgot_password =""; var new_user =""; var check_form_ok; var venue_type_plural; var ajax_array; var baseIcon; var icon; var marker; var map; var bounds; var point_message; var point_pic; var point_grade; var point_grades; var xml_data; var xml; var markers; var extend_bounds="yes"; var lat; var long; var point_link; var point_id; var curDateTime; var tooltip; var greenCross; var own_offset_x =0; var own_offset_y =0; var ad; var point; var offset; var anchor; var width; var height; var pos; var map_southwest; var map_southwest_lat; var map_southwest_long; var map_center; var map_center_lat; var map_center_long ; var marker_position; var marker_lat; var marker_long; var map_lat_dif var map_long_dif; var marker_lat_dif; var marker_long_dif; var marker_offset_lat; var marker_offset_long; var searchstringclean; var searchstring; var thing_text=""; var comment_part_2_loaded ="no"; var comment_part_3_loaded ="no"; var cookie_expire_date; var user_login_code; var user_nicename; var logged_out; var last_reviews_xml_data; var last_reviews_xml; var last_reviews; var review_description; var review_time; var review_venue_name; var review_link; var review_author_link; var our_delay; var review_author_image; var user_first_time_code=""; var user_password_code=""; var user_nicename_array; var user_nicename_array_2; var sorting_menu_good_bad_original =""; var sorting_menu_type_of_place_original =""; var change_review_underway ="no"; // setting cookie function setCookie(c_name,value,expiredays) { var cookie_expire_date=new Date(); cookie_expire_date.setDate(cookie_expire_date.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+cookie_expire_date.toGMTString()+";path=/"); } // getting cookie function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } // IF THE TEXTAREA IS CLICKED function textarea_clicked(t, whichname) { if (comment_part_3_loaded=="no" && are_we_logged_in!="yes") { load_email_box(); comment_part_3_loaded="yes"; } // expand textarea var a = t.value.split('\n'); var b=1; for (x=0;x < a.length; x++) { if (a[x].length >= t.cols) b+= Math.floor(a[x].length/t.cols); } b+= a.length; if (b > t.rows) t.rows = b; // max 400 characters our_review_length = (t.value.length); document.getElementById("comment_alert_2" + whichname).innerHTML = ""; if (our_review_length > 500 && our_review_length < 601) { document.getElementById("comment_alert_2" + whichname).innerHTML = "Maximum characters left: " + (600-our_review_length); } if (our_review_length > 600) { document.getElementById("comment_alert_2" + whichname).innerHTML = "The text is too long!"; } } // LOAD TEXTAREA BOX function load_textarea_box() { if (document.getElementById("comment_part_box_2").innerHTML=="") { document.getElementById("comment_part_box_2").innerHTML =""; } } // LOAD EMAIL BOX function load_email_box() { document.getElementById("comment_part_box_3").innerHTML =""; } // LOAD PASSWORD BOX function load_password_box() { document.getElementById("comment_part_box_4").innerHTML =""; } // mymouseover function mymouseover(i,own_offset_x,own_offset_y,ad) { if (map_is_loaded=="yes") {  map_movements_listener="off"; // turn off for webpage movements not directly by user if (i!=1000 && ad!="yes") { document.getElementById('venue_' + i).style.backgroundColor='#efe6da'; } // change li style pan_if_outside(gmarkers[i]); showTooltip(gmarkers[i],own_offset_x,own_offset_y); if (i!=1000) { gmarkers[i].setImage('http://www.allakartor.se/mapicons/red_dot.png'); } if (i==1000) { map_movements_listener="on";window.setTimeout('tooltip.style.visibility="hidden";',15000);} } } // mymouseout function mymouseout(i,ad) { if (map_is_loaded=="yes") {  if (ad!="yes") { document.getElementById('venue_' + i).style.backgroundColor='#ffffff'; } // change li style tooltip.style.visibility="hidden"; gmarkers[i].setImage('http://www.allakartor.se/mapicons/yellow_light.png'); map_movements_listener="on"; // turn back on! ad="no"; } } // SHOW INITIAL TOOLTIP function show_initial_tooltip() { window.setTimeout('showTooltip(gmarkers[1000],-50,-50);hide_initial_tooltip();',1500); } // HIDE INITIAL TOOLTIP function hide_initial_tooltip() { window.setTimeout('tooltip.style.visibility="hidden";',15000); } // listen for map movements function listen_for_map_movements() { GEvent.addListener(map, "moveend", function() { if (map_movements_listener=="on" && mouse_over_map=="yes") { document.getElementById("map_movement_feedback").innerHTML = "You have moved the map. Do you want to show hotels in the new map area?

"; document.getElementById("map_movement_feedback").style.visibility = 'visible'; } }); } // manually load venues function manually_load_venues() { tooltip.style.visibility="hidden"; map.clearOverlays(); map_is_loaded="no"; // turn off highlighting of the old ten places on the map extend_bounds = "no"; // do not extend bound after places are loaded document.getElementById("map_movement_feedback").innerHTML = "Fetching hotels..."; GDownloadUrl("/ajax.php?action=manually_load_venues¢er=" + map.getCenter().toString() + "&southwest=" + map.getBounds().getSouthWest().toString(), function(data, responseCode) { xml_data = data; loop_markers(); if (markers.length == 0) { document.getElementById("map_movement_feedback").innerHTML = "Found no hotels in this map area.

Tips: Try zooming out."; } if (markers.length >49) { document.getElementById("map_movement_feedback").innerHTML = "Showing 1-50 of more than 50 hotels in the map area.

Tip: Zoom in for better overview.
";window.setTimeout('document.getElementById("map_movement_feedback").style.visibility = "hidden"',10000); } if (markers.length < 50 && markers.length!=0) { document.getElementById("map_movement_feedback").innerHTML = "Found " + markers.length + " " + " hotels within the map area.";window.setTimeout('document.getElementById("map_movement_feedback").style.visibility = "hidden"',5000); }  }); } // A function to create the marker and set up the event window function createMarker(point,point_message,point_pic,point_grade,point_grades,point_link,point_id) { var icon = new GIcon(baseIcon); icon.image = "http://www.allakartor.se/mapicons/yellow_light.png"; var marker = new GMarker(point, icon); if(!point_grade){marker.tooltip = '
'+point_message+'
';} if(point_grade){ if(point_pic!=""){point_pic='background:url('+point_pic+') 0 0 no-repeat transparent;';} if(point_grades==""){point_grade='width:16px;background:url(http://www.allakartor.se/graphics/star_16_nofill.gif)';point_grades='No reviews';}else{point_grade='width:'+point_grade+'px';} marker.tooltip = '
'+point_message+'
'+point_grades+'
'; } gmarkers[i] = marker; i++; map.addOverlay(marker); // --- ADD LISTENERS --- // --- MOUSE OVER --- GEvent.addListener(marker,'mouseover', function() { showTooltip(marker,-40,0); // show tooltip marker.setImage('http://www.allakartor.se/mapicons/red_dot.png'); // change icon if (map_is_loaded=="yes") { document.getElementById('venue_' + point_id).style.backgroundColor='#EFE6DA'; } // change li style }); // --- MOUSE OUT --- GEvent.addListener(marker,'mouseout', function() { tooltip.style.visibility='hidden'; // hide tooltip marker.setImage('http://www.allakartor.se/mapicons/yellow_light.png'); // change icon if (map_is_loaded=="yes") { document.getElementById('venue_' + point_id).style.backgroundColor='#FFFFFF'; } // change li style }); // --- GO TO LINK ON CLICK --- GEvent.addListener(marker, 'click', function() {self.location.href = point_link;}); // --- END LISTENERS --- } // A function to create the green cross function createGreenCross(point,point_message,point_pic,point_grade,point_grades) { var icon = new GIcon(greenCross); var marker = new GMarker(point, icon); gmarkers[1000] = marker; // === store the name so that the tooltip function can use it === if(!point_grade){marker.tooltip = '
Here is
'+point_message+'
';} if(point_grade){ if(point_pic!=""){point_pic='background:url('+point_pic+') 0 0 no-repeat transparent;'}; if(point_grades==""){point_grade='width:16px;background:url(http://www.allakartor.se/graphics/star_16_nofill.gif)';point_grades='No reviews';}else{point_grade='width:'+point_grade+'px';} marker.tooltip = '
'+point_message+'
'+point_grades+'
';} map.addOverlay(marker); // --- ADD LISTENERS --- // --- MOUSE OVER --- GEvent.addListener(marker,'mouseover', function() { showTooltip(marker,-50,0); // show tooltip }); // --- MOUSE OUT --- GEvent.addListener(marker,'mouseout', function() { tooltip.style.visibility='hidden'; // hide tooltip }); // --- END LISTENERS --- } // === TOOLTIP FUNCTION STARTS ========= function showTooltip(marker,own_offset_x,own_offset_y) { tooltip.innerHTML = marker.tooltip; point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom()); offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom()); anchor=marker.getIcon().iconAnchor; width=marker.getIcon().iconSize.width; height=tooltip.clientHeight; pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width + own_offset_x, offset.y - point.y -anchor.y -height + own_offset_y)); pos.apply(tooltip); tooltip.style.visibility="visible"; } // === TOOLTIP FUNCTION ENDS ========= // === PAN-IF-OUTSIDE STARTS === function pan_if_outside(marker) { map_southwest = map.getBounds().getSouthWest().toString(); map_southwest = map_southwest.split(","); map_southwest_lat = map_southwest[0].replace("(", "").replace(" ",""); map_southwest_long = map_southwest[1].replace(")", "").replace(" ",""); map_center = map.getCenter().toString(); map_center = map_center.split(","); map_center_lat = map_center[0].replace("(", "").replace(" ",""); map_center_long = map_center[1].replace(")", "").replace(" ",""); marker_position = marker.getPoint().toString(); marker_position = marker_position.split(","); marker_lat = marker_position[0].replace("(", "").replace(" ",""); marker_long = marker_position[1].replace(")", "").replace(" ",""); map_lat_dif = map_center_lat - map_southwest_lat; map_long_dif = map_center_long - map_southwest_long; marker_lat_dif = map_center_lat - marker_lat; marker_long_dif = map_center_long - marker_long; marker_offset_lat = marker_lat_dif / map_lat_dif; marker_offset_long = marker_long_dif / map_long_dif; if ( (marker_offset_lat < -0.6) && (marker_offset_long < 0) || (marker_offset_lat < 0) && (marker_offset_long < -0.7)) // Less so we can see the text to the top and right { map.panTo(new GLatLng((1*marker_lat-1*(map_lat_dif/2)), (1*marker_long-1*(map_long_dif/4)))); // So we can see the text to the right } if ( (marker_offset_lat < -0.6) && (marker_offset_long > 0) || (marker_offset_lat < 0) && (marker_offset_long > 0.75)) // Less because the controls are in the way here { map.panTo(new GLatLng((1*marker_lat-1*(map_lat_dif/2)), (1*marker_long+1*(map_long_dif/2)))); } if ( (marker_offset_lat > 0.9) && (marker_offset_long < 0) || (marker_offset_lat > 0) && (marker_offset_long < -0.7)) // Less so we can see the text to the right { map.panTo(new GLatLng((1*marker_lat+1*(map_lat_dif/2)), (1*marker_long-1*(map_long_dif/4)))); // So we can see the text to the right } if ( (marker_offset_lat > 0.9) && (marker_offset_long > 0) || (marker_offset_lat > 0) && (marker_offset_long > 0.9)) { map.panTo(new GLatLng((1*marker_lat+1*(map_lat_dif/2)), (1*marker_long+1*(map_long_dif/2)))); } } // === PAN IF OUTSIDE ENDS === // WHEN WE SEARCH FOR A CITY function function_search_place(submit_type) { document.getElementById("search_result").style.visibility = "visible"; document.getElementById("search_result").innerHTML = "\"Working...\""; searchstringclean = document.form_search.searchtext.value; if (document.form_search.searchthing) { searchstringclean += "&thing=" + document.form_search.searchthing.value} if (document.form_search.searchdistance) { searchstringclean += "&distance=" + document.form_search.searchdistance.value} searchstring = "/ajax.php?action=" + submit_type + "&q=" + searchstringclean + "&more=" + more_or_not; GDownloadUrl(searchstring, function(data, responseCode) { document.getElementById("search_result").innerHTML = data ; }); } // WHEN WE CLICK THE "SUBMIT REVIEW" BUTTON function submit_review(which, which_venue_id, which_review_id) { var poststr = ""; document.getElementById("send_review_indicator" + which).style.visibility = "visible"; if (new_user=="y") { poststr += "&new_user=y"} if (forgot_password=="y") { poststr += "&forgot_password=y"}  if (our_review_email != "" ) { poststr += "&our_review_email=" + escape(encodeURI(our_review_email)); } if (secure_password != "" ) { poststr += "&secure_password=" + secure_password; } poststr += "&our_review_venue_id=" + which_venue_id; poststr += "&our_review_id=" + which_review_id; poststr += "&our_review_grade=" + escape(encodeURI(our_review_grade.substring(0,1))); poststr += "&our_review=" + escape(encodeURI( document.getElementById("our_review" + which).value )); var searchstring = "/ajax.php?action=update_review" + poststr ; GDownloadUrl(searchstring, function(data, responseCode) { //alert(searchstring);alert(data); // split return into an array ajax_array = data.split('|'); document.getElementById("send_review_indicator" + which).style.visibility = "hidden"; if (ajax_array[0]==1) { } if (ajax_array[0]==2) { } if (ajax_array[0]==3) { load_email_box(); document.getElementById("comment_alert_3").innerHTML = ajax_array[1]; document.getElementById("comment_part_box_3").className = "comment_part_box_highlighted"; document.form_write_review.our_review_email.focus(); if (document.getElementById("alert_box_4_2")) { document.getElementById("alert_box_4_2").innerHTML =""; } if (ajax_array[1]=="This email adress is new to us.") { document.getElementById("comment_part_box_3").innerHTML += " Tick this box if you are using this website for the first time."; } if (ajax_array[1]=="This email adress is not yet activated.") { document.getElementById("comment_part_box_3").innerHTML += " Tick this box if you want to activate your membership!"; } } if (ajax_array[0]==4) { load_password_box(); document.getElementById("comment_alert_4").innerHTML = ajax_array[1]; document.getElementById("comment_part_box_4").className = "comment_part_box_highlighted"; document.form_write_review.our_review_password.focus(); if (document.getElementById("alert_box_3_2")) { document.getElementById("alert_box_3_2").innerHTML =""; }  if (ajax_array[1]!="Ange ditt lösenord.") { document.getElementById("comment_part_box_4").innerHTML += " Tick this box if you forgot your password."; } } if (ajax_array[0]==5) { if (are_we_logged_in!="yes") { if (document.getElementById("alert_box_3_2")) { document.getElementById("alert_box_3_2").innerHTML =""; } if (document.getElementById("alert_box_4_2")) { document.getElementById("alert_box_4_2").innerHTML =""; } if (ajax_array[1]=="Klar. Lösenord saknas.") { alert(ajax_array[2]);location.href = location.href; } if (ajax_array[1]=="Klar.") { alert("Thank you for your review. \n\n You are now logging in!"); location.href = "http://www.allakartor.se/super_login.php?username=" + our_review_email + "&secure_password=" + secure_password + "&next=" + escape(encodeURI(location.href)) + "&remember_me=y";} if (ajax_array[1]=="Klar. Din recension har uppdaterats.") { alert(ajax_array[2]); location.href = "http://www.allakartor.se/super_login.php?username=" + our_review_email + "&secure_password=" + secure_password + "&next=" + escape(encodeURI(location.href)) + "&remember_me=y";} if (ajax_array[1]=="Klar. Bli medlem.") { alert(ajax_array[2]); location.href = "/medlem/" + ajax_array[3] + "/"; } if (ajax_array[1]=="Klar. Konstig text.") { alert(ajax_array[2]);location.href = location.href; } } else { if (ajax_array[1]=="Klar.") { alert("Thank you for your review!");location.href = location.href; } if (ajax_array[1]=="Klar. Din recension har uppdaterats.") { alert("Your review has been updated!");location.href = location.href; } } } }); } // LOAD THE LOGIN-TEXT function load_login () { if (document.getElementById("div_login_text").innerHTML =='') { document.getElementById("div_login_text").innerHTML = "
Email: Password: Remember me:
"; } else { document.getElementById("div_login_text").innerHTML = ""; } } // LOAD LOGIN_PROXY function load_login_proxy () { if (document.getElementById('login_proxy').style.visibility == 'hidden') { document.getElementById('login_proxy').style.visibility='visible'; } else { document.getElementById('login_proxy').style.visibility='hidden'; } } // LOAD "SORTING_MENU_GRADE" function load_sorting_menu_grade () { document.getElementById("sorting_menu_grade").innerHTML = "Best grades within: 1000 meters | 2000 meters | 5000 meters"; } // LOAD "SORTING_MENU_PRICE" function load_sorting_menu_price () { document.getElementById("sorting_menu_price").innerHTML = "Worst grades within: 1000 meters | 2000 meters | 5000 meters"; } // LOAD "SORTING_MENU_AD_LATEST" function load_sorting_menu_ad_latest () { document.getElementById("sorting_menu_ad_latest").innerHTML = "Newest within: 2 km | 5 km | 50 km | all distances"; } // LOAD "SORTING_MENU_GOOD_BAD" function load_sorting_menu_good_bad () { document.getElementById("sorting_menu_good_bad").innerHTML = "Grade: Best grades | Worst grades";return false; } // CHECK IF THE FORM IS OK function function_check_form (which, which_venue_id, which_review_id) { // first reset check_form_ok ="yes"; document.getElementById("comment_part_box_1" + which).className = "comment_part_box"; document.getElementById("comment_alert_2" + which).innerHTML = ""; document.getElementById("comment_part_box_2" + which).className = "comment_part_box"; // grade if (our_review_grade =="0") { document.getElementById("comment_part_box_1" + which).className = "comment_part_box_highlighted"; check_form_ok="no"; } // review our_review_length = (document.getElementById("our_review" + which).value.length); if (our_review_length < 40) { document.getElementById("comment_alert_2" + which).innerHTML = "YOur review must be at least 30 characters."; document.getElementById("comment_part_box_2" + which).className = "comment_part_box_highlighted"; //document.form_write_review.our_review.focus(); check_form_ok="no"; } if (our_review_length > 600) { document.getElementById("comment_alert_2" + which).innerHTML = "The text is too long!"; document.getElementById("comment_part_box_2" + which).className = "comment_part_box_highlighted"; //document.form_write_review.our_review.focus(); check_form_ok="no"; } // email if (document.getElementById("comment_part_box_3") && document.getElementById("comment_part_box_3").innerHTML !="") { //first reset document.getElementById("comment_alert_3").innerHTML = ""; document.getElementById("comment_part_box_3").className = "comment_part_box"; our_review_email = document.getElementById("our_review_email").value; // number of @-signs our_review_email_at_signs = our_review_email.split('@'); if (our_review_email_at_signs.length != 2) { document.getElementById("comment_alert_3").innerHTML = "Strange email adress."; document.getElementById("comment_part_box_3").className = "comment_part_box_highlighted"; check_form_ok="no"; } // email length our_review_email_length = (our_review_email.length) ; if (our_review_email_length < 7) { document.getElementById("comment_alert_3").innerHTML = "Strange email adress."; document.getElementById("comment_part_box_3").className = "comment_part_box_highlighted"; check_form_ok="no"; } } // password if (document.getElementById("comment_part_box_4") && document.getElementById("comment_part_box_4").innerHTML !="") { // first reset document.getElementById("comment_alert_4").innerHTML = ""; document.getElementById("comment_part_box_4").className = "comment_part_box"; our_review_password = document.getElementById("our_review_password").value; our_review_password_length = (our_review_password.length) ; if (our_review_password_length < 5) { document.getElementById("comment_alert_4").innerHTML = "The password is too short."; document.getElementById("comment_part_box_4").className = "comment_part_box_highlighted"; check_form_ok="no"; } else { password = our_review_password; hash_password(); } } // new user if (document.getElementById("new_user")) { if ( document.getElementById("new_user").checked) { new_user= "y"; } else { new_user= ""; }  } // forgot password if (document.getElementById("forgot_password")) { if ( document.getElementById("forgot_password").checked) { forgot_password= "y"; } else { forgot_password= ""; }  } // if everything looks ok, submit review //alert("form: " + check_form_ok); if (check_form_ok!="no") { submit_review(which, which_venue_id, which_review_id); } } // loop markers function loop_markers(which_webpage) { /* ADS ON MAP! if(which_webpage=="Annonskartan.se"){ var publisher_id = "pub-2741106300689510"; // my AdSense id adsManagerOptions = { maxAdsOnMap : 1, style: G_ADSMANAGER_STYLE_ADUNIT, channel: '2077425081' }; adsManager = new GAdsManager(map, publisher_id, adsManagerOptions); adsManager.enable(); } END ADS */ xml = GXml.parse(xml_data); markers = xml.documentElement.getElementsByTagName("marker"); // --- FOR EACH MARKER, ADD OVERLAY --- for (j = 0; j < markers.length; j++) { // obtain the attribues of each marker lat = parseFloat(markers[j].getAttribute("lat")); long = parseFloat(markers[j].getAttribute("long")); point = new GLatLng(lat,long); point_link = markers[j].getAttribute("point_link"); // create the marker point_id = j; point_message = markers[j].getAttribute("point_message"); point_pic = markers[j].getAttribute("point_pic"); point_grade = markers[j].getAttribute("point_grade"); point_grades = markers[j].getAttribute("point_grades"); marker = createMarker(point,point_message,point_pic,point_grade,point_grades,point_link,point_id); if (extend_bounds=="yes") { bounds.extend(point); } // map-to-fit } if (j>0 && extend_bounds=="yes") { map.setCenter(bounds.getCenter()); } // map-to-fit if ((j>1 && extend_bounds=="yes") || (which_webpage=="Annonskartan.se")) { map.setZoom(map.getBoundsZoomLevel(bounds)); } // map-to-fit // WE WANT TO EXTEND THE MAP A LITTLE MORE: map_southwest = map.getBounds().getSouthWest().toString(); map_southwest = map_southwest.split(","); map_southwest_lat = map_southwest[0].replace("(", "").replace(" ",""); map_southwest_long = map_southwest[1].replace(")", "").replace(" ",""); map_center = map.getCenter().toString(); map_center = map_center.split(","); map_center_lat = map_center[0].replace("(", "").replace(" ",""); map_center_long = map_center[1].replace(")", "").replace(" ",""); map_lat_dif = map_center_lat - map_southwest_lat; map_long_dif = map_center_long - map_southwest_long; map_extend_lat = (map_center_lat)*1 + (map_lat_dif)*100/80; map_extend_long = (map_center_long)*1 + (map_long_dif)*100/80; bounds.extend(new GLatLng(map_extend_lat,map_extend_long)); if (j>0 && extend_bounds=="yes") { if (map.getBoundsZoomLevel(bounds)!=0){map.setZoom(map.getBoundsZoomLevel(bounds));}else{map.setZoom(1);} } // map-to-fit if (j==0 && extend_bounds=="yes") { map.setZoom(4); } // map-to-fit } // loop latest reviews function loop_latest_reviews() { last_reviews_xml = GXml.parse(last_reviews_xml_data); last_reviews = last_reviews_xml.documentElement.getElementsByTagName("review"); // --- FOR EACH REVIEW --- for (j = 0; j < last_reviews.length; j++) { // obtain the attribues of each marker review_description = last_reviews[j].getAttribute("review_description"); review_time = last_reviews[j].getAttribute("review_time"); review_venue_name = last_reviews[j].getAttribute("review_venue_name"); review_link = last_reviews[j].getAttribute("review_link"); review_author_link = 'http://allakartor.tedshotelmap.com/user/' + last_reviews[j].getAttribute("review_author_link"); our_delay = (j*12000); review_author_image = ''; setTimeout('document.getElementById("last_user_image").innerHTML = "' + review_author_image + '";', our_delay); setTimeout('document.getElementById("last_user_comment_span").innerHTML = "' + review_time + '
Om ' + review_venue_name + ': ' + review_description + '";', our_delay); } } // loop user_nicename function loop_user_nicename() { user_nicename_array = user_nicename_array.split("||"); for (j = 0; j < (user_nicename_array.length)-1; j++) { user_nicename_array_2 = user_nicename_array[j].split("|"); if (user_nicename_array_2[0] == user_nicename) { document.getElementById("alarm_" + user_nicename_array_2[1]).innerHTML = "change | add a picture | delete"; } } } // FUNCTION TO HASH THE PASSWORD function hash_password() { // Get password if (document.getElementById('password')) { password = document.getElementById('password').value; } if (document.getElementById('our_review_password')) { password = document.getElementById('our_review_password').value; } if (password != "" && password !=null) { // Hash password secure_password = md5(password); //alert(secure_password); // Save hashed password if (document.getElementById('secure_password')!=null) { document.getElementById('secure_password').value = secure_password; } // Remove plain password password.value = ''; if (document.getElementById('next') != null ) { // Set location so we get back to the same page document.getElementById('next').value = location.href; } } } // CLICK SMALL IMAGE function showPic (whichpic) { var desc_array; if (document.getElementById) { var href_array = whichpic.href.split("images/"); document.getElementById('desc').innerHTML = "sss"; document.getElementById('large_image').src = "http://www.allakartor.se/venue_images_475/" + href_array[1] + ".jpg"; if (whichpic.title) { desc_array = whichpic.title.split("*"); // change the link for report_this_item if (desc_array[1] == user_nicename) { document.getElementById('report_this_item').innerHTML = "Delete the picture"; } else { document.getElementById('report_this_item').innerHTML = "Report the picture"; } desc_array = desc_array[0] + "" + desc_array[1] + ""; document.getElementById('desc').innerHTML = desc_array; } else { desc_array = whichpic.childNodes[0].nodeValue; document.getElementById('desc').childNodes[0].nodeValue = desc_array; } return false;sumbit } else { return true; } } // AJAX_SUBMIT function ajax_submit(submit_type, which, which_venue, which_user) { if ( (submit_type=="add_friend" || submit_type=="remove_friend") && are_we_logged_in!="yes") { alert('You have to log in to do this'); } if ( (submit_type=="verify" || submit_type=="verify_remove") && are_we_logged_in!="yes") { alert('You have to log in to do this.\n\nLog in or become a member in the upper right corner.\nIt is fast and simple, I promise.'); } if (submit_type=="report_review") { var answer = confirm("Are you sure this review is inappropriate and you want to report it??"); } if (submit_type=="report_picture") { var answer = confirm("Are you sure this picture is inappropriate and you want to report it?"); } if (submit_type=="remove_review") { var answer = confirm("Are you sure you want to remove this review."); } if (submit_type=="remove_picture") { var answer = confirm("Are you sure you want to remove this picture."); } if (submit_type=="remove_friend") { var answer = confirm("Are you sure you want to un-friend this person?"); } if (submit_type=="verify" && are_we_logged_in=="yes") { var answer = confirm("Click OK to confirm."); } if (submit_type=="verify_remove" && are_we_logged_in=="yes") { var answer = confirm("Dou you want to remove this place?"); } if (answer|| submit_type=="picture_description" || submit_type=="add_friend" || submit_type=="thumb_up" || submit_type=="thumb_down"){ var poststr = "&item_id=" + escape(encodeURI( which )); if (submit_type=="thumb_up" || submit_type=="thumb_down"){ poststr = poststr + "&venue_id=" + escape(encodeURI( which_venue )) + "&user_id=" + escape(encodeURI( which_user )) } poststr = poststr + "&our_review_email=" + escape(encodeURI(our_review_email)); poststr = poststr + "&secure_password=" + secure_password; if (submit_type=="picture_description") { var picture_id = document.getElementById("picture_id").value; var picture_id_array = picture_id.split("_"); poststr = poststr + "&picture_description=" + escape(encodeURI( document.getElementById("picture_description").value )); poststr = poststr + "&picture_id=" + picture_id; } if ( (submit_type=="report_review" || submit_type=="report_picture" || submit_type=="thumb_up" || submit_type=="thumb_down") || (are_we_logged_in=="yes")) { var searchstring = "/ajax.php?action=" + submit_type + poststr ; GDownloadUrl(searchstring, function(data, responseCode) { //alert(searchstring); if (data!="thumbs_1" && data!="thumbs_0"){alert(data);} if (data=="thumbs_1" || data=="thumbs_0"){document.getElementById(data + "_" + which).innerHTML= " " + (parseInt(document.getElementById(data + "_" + which).innerHTML)+1) + " ";document.getElementById(data + "_" + which).style.backgroundColor='#FFF';} if (data == "Bilden har tagits bort." || data == "Recensionen har tagits bort."|| submit_type=="verify" || submit_type=="verify_remove") {self.location.href = self.location.href; } if (data == "Bildtexten har sparats!") { location.href = "/0" + picture_id_array[0] + "/images/" + picture_id + "/"; } if (data == "Personen har nu lagts till i listan över dina favorit-recensenter.") {document.getElementById("change_my_settings").innerHTML = "is one of your connections."; } if (data == "This person is no longer among your connections.") { document.getElementById("change_my_settings").innerHTML = "is no longer among your
connections."; } }); } } } // CHANGE REVIEW function submit_change_this(which, which_venue_id, which_venue_name) { if (change_review_underway =="yes") {alert("You can only change one review at a time.");} else { var this_review = document.getElementById("review_desc_" + which).innerHTML; //alert(this_review); document.getElementById("review_" + which).style.padding = "10px 10px 0 20px"; document.getElementById("alarm_" + which).innerHTML = "cancel | delete"; document.getElementById("review_" + which).innerHTML ="My review of " + which_venue_name + ": \"Working...\" "; change_review_underway ="yes"; } } // MOUSE FOLLOWER function mouse_follower(i) { document.getElementById('mouse_follower').innerHTML = i; var divName = 'mouse_follower'; // div that is to follow the mouse // (must be position:absolute) var offX = 15; // X offset from mouse position var offY = 15; // Y offset from mouse position document.getElementById('mouse_follower').style.visibility = 'visible'; function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;} function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;} function follow(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; /*obj.visibility = 'visible'; */ obj.left = (parseInt(mouseX(evt))+offX) + 'px'; obj.top = (parseInt(mouseY(evt))+offY) + 'px';} } document.onmousemove = follow; } // MOUSE FOLLOWER CLOSE function mouse_follower_close(i) { document.getElementById('mouse_follower').style.visibility = 'hidden'; /* function follow() { var obj = document.getElementById('mouse_follower').style; obj.left = '0px'; obj.top = '0px';} document.onmousemove = follow;*/ }