/************************************ 123RF.com Global Javascript Functions ************************************/ // Scripts used in Main Page function search_text_onfocus(obj, def_value) { if (obj.value == def_value) { obj.value = ''; } // else obj.select(); } function search_text_onblur(obj, def_value) { if (obj.value == '' || obj.value == def_value) { obj.value = def_value; } } function hover_thumb(status, coord) { var thumb = 'thumb' + coord; if (status == 0) document.getElementById(thumb).style.opacity = 1; else if (status == 1) document.getElementById(thumb).style.opacity = 0.8; } // Scripts used in Main Page function toggle_search_options(id, id_caption) { if (document.getElementById(id) != null) { if (document.getElementById(id).style.display == 'block') { document.getElementById(id).style.display = 'none'; if (document.getElementById(id_caption) != null) document.getElementById(id_caption).innerHTML = '▼'; remembersearchbar(0); } else { document.getElementById(id).style.display = 'block'; if (document.getElementById(id_caption) != null) document.getElementById(id_caption).innerHTML = '▲'; remembersearchbar(1); } } } // advanced search options functions function searchsubmit(form) { var search = form.word; if(search.value.length == 0 || search.value == "Enter keywords or image code") { alert("Please enter a keyword."); search.focus(); // search.select(); // search.value = "Enter keywords or image code"; return false; } document.getElementById('icon_searching').style.display = 'block'; // so that the browser does not submit the X and Y coordinates document.getElementById("gosubmit").disabled = true; document.getElementById("t_word").value = ""; if (document.getElementById('g_lang_uni') != null && document.getElementById('g_lang_uni').style.display != "none") { document.getElementById("t_lang").value = document.getElementById('g_lang_uni').value; } var current_lang = document.getElementById("t_lang").value; if(current_lang != "en") { if(current_lang == "gb") { current_lang = "zh-CN"; } else if(current_lang == "jp") { current_lang = "ja"; } else if(current_lang == "cz") { current_lang = "cs"; } google.language.translate(search.value,current_lang,"en",function(result) { if(result.translation) { document.getElementById("t_word").value = result.translation.toLowerCase(); form.submit(); } }); return false; } else { return true; } } function searchagain_submit() { var form = document.searchform; var search = form.search_text; if(search.value.length == 0 || search.value == "Enter keywords or image code") { alert("Please enter a keyword."); search.focus(); // search.select(); // search.value = "Enter keywords or image code"; return false; } form.submit(); } // global $thispage, $word, $match, $itemsperpage, $cka, $exclude, $imgtype, $exppl, $orderby, $cko; function resetsearch() { var searchform = document.searchform; if (searchform.search_text != null) searchform.search_text.value = ''; if (searchform.match != null) searchform.match[0].checked = true; // if (searchform.itemsperpage != null) searchform.itemsperpage[1].checked = true; if (searchform.exclude != null) searchform.exclude.value = ''; if (searchform.cka != null) searchform.cka.checked = false; if (searchform.imgtype != null) searchform.imgtype[0].checked = true; if (searchform.cko != null) searchform.cko[0].checked = true; // if (searchform.orderby != null) searchform.orderby[2].checked = true; if (searchform.orderby != null) searchform.orderby[0].checked = true; if (searchform.exppl != null) searchform.exppl[0].checked = true; if (searchform.nonudity != null) searchform.nonudity.checked = false; if (searchform.colorrange != null) searchform.colorrange[0].checked = true; } // advanced search options functions // overlib functions // required variables: $supplier_name, $cd_code, $file_name // new items: photograher's name, image description // magnify('$supplier_name', '$cd_code', '$file_name', '$image_desc_uc'); function magnify_old(supplier_name, cd_code, file_name, image_desc, width, height) { var imgsrc = 'http://sg.123rf.com/400nwm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; if (width == 0 || height ==0) var imgdiv = ''; else var imgdiv = ''; var imgdesc = '
' + image_desc + '
'; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgdesc + imgphotog, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // if (width == 0 || height == 0) return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // else return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // return overlib('', HAUTO, VAUTO, BGCOLOR, '#AAAAAA', FGCOLOR, '#AAAAAA'); } function magnifysmall_old(supplier_name, cd_code, file_name, width, height) { var imgsrc = 'http://sg.123rf.com/168nwm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; if (width == 0 || height == 0) var imgdiv = ''; else var imgdiv = ''; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgphotog, WIDTH, 10, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); } // new magnify functions using cache servers (v2) function magnify_v2(cacheserver, supplier_name, cd_code, file_name, image_desc, width, height) { if (cacheserver == '') cacheserver = 'http://images.123rf.com/us'; var imgsrc = cacheserver + '/400wm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; if (width == 0 || height ==0) var imgdiv = ''; else var imgdiv = ''; var imgdesc = '
' + image_desc + '
'; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgdesc + imgphotog, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // if (width == 0 || height == 0) return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // else return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // return overlib('', HAUTO, VAUTO, BGCOLOR, '#AAAAAA', FGCOLOR, '#AAAAAA'); } function magnifysmall_v2(cacheserver, supplier_name, cd_code, file_name, width, height) { if (cacheserver == '') cacheserver = 'http://images.123rf.com/us'; var imgsrc = cacheserver + '/168nwm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; if (width == 0 || height == 0) var imgdiv = ''; else var imgdiv = ''; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgphotog, WIDTH, 10, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); } // new magnify functions using cache servers (v3) function magnify(supplier_name, cd_code, file_name, image_desc, width, height) { if (!window.cacheserver || cacheserver == '') cacheserver = 'http://sg.123rf.com'; var imgsrc = cacheserver + '/400wm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; //modified by js if (width == 0) var imgdiv = ''; else var imgdiv = ''; //by lh //if (width == 0 || height ==0) var imgdiv = ''; //else var imgdiv = ''; var imgdesc = '
' + image_desc + '
'; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgdesc + imgphotog, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // if (width == 0 || height == 0) return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // else return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // return overlib('', HAUTO, VAUTO, BGCOLOR, '#AAAAAA', FGCOLOR, '#AAAAAA'); } function magnifysmall(supplier_name, cd_code, file_name, width, height) { if (!window.cacheserver || cacheserver == '') cacheserver = 'http://sg.123rf.com'; var imgsrc = cacheserver + '/168nwm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; if (width == 0 || height == 0) var imgdiv = ''; else var imgdiv = ''; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgphotog, WIDTH, 10, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); } // reveal lightbox drop down box function reveallb() { document.getElementById('lightbox_select').style.display = 'inline'; document.getElementById('lightbox_text').style.display = 'none'; document.getElementById('lightbox_select').focus(); } // hide the lightbox drop down box while focus is lost function hidelb() { document.getElementById('lightbox_select').style.display = 'none'; document.getElementById('lightbox_text').style.display = 'inline'; } // Remember Advanced Search bar state function remembersearchbar(state) { var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('advsrch', state, futdate, '/','.123rf.com'); } // create new lightbox function do_create () { var new_name = prompt('Please enter a name for the new lightbox.', ''); if (new_name != null) { document.lightboxaction.text.value = new_name; document.lightboxaction.action.value = 'create'; document.lightboxaction.submit(); var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('lightid', '', futdate, '/','.123rf.com'); } } // rename lightbox function do_rename (oldname, id) { oldname = decodeURI(oldname); var new_name = prompt('Please enter a new name for this lightbox.', oldname); if (new_name != null) { document.lightboxaction.text.value = new_name; document.lightboxaction.action.value = 'rename'; document.lightboxaction.submit(); var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('lightid', id, futdate, '/','.123rf.com'); } } // delete existing ligthbox function do_delete (n) { if (confirm('Are you sure you want to delete this lightbox?')) { document.lightboxaction.text.value = n; document.lightboxaction.action.value = 'delete'; document.lightboxaction.submit(); } } function do_privacy(id, privacy) { document.lightboxaction.text.value = privacy; document.lightboxaction.action.value = 'setprivacy'; document.lightboxaction.submit(); } function do_note() { document.lightboxaction.text.value = document.getElementById('light_note').value; document.lightboxaction.action.value = 'note'; document.lightboxaction.submit(); } // remember current ligthbox function rememberlightbox(id) { var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('lightid', id, futdate, '/','.123rf.com'); // alert(id); } // javascript reminder function confirm_reminder(msg) { if (confirm(msg)) return true; return false; } // switch between color themes function applytheme (color) { if (document.getElementById('logocolor') != null && document.getElementById('sbarcolor') != null) { // save current theme to a hidden variable, to be used on mouseover effects of pricing table if(document.getElementById('curtheme') != null) document.getElementById('curtheme').value = color; // reset the color theme buttons // the selected button will be changed later in the switch statement if(document.getElementById('orangetheme') != null) document.getElementById('orangetheme').className = 'orangetheme'; if(document.getElementById('bluetheme') != null) document.getElementById('bluetheme').className = 'bluetheme'; if(document.getElementById('greentheme') != null) document.getElementById('greentheme').className = 'greentheme'; if(document.getElementById('silvertheme') != null) document.getElementById('silvertheme').className = 'silvertheme'; if(document.getElementById('pinktheme') != null) document.getElementById('pinktheme').className = 'pinktheme'; switch (color) { case 'orange': if (document.getElementById('logocolor') != null) document.getElementById('logocolor').className = 'logo logo_orange'; if (document.getElementById('sbarcolor') != null) document.getElementById('sbarcolor').className = 'container_search_bar sbar_orange'; if (document.getElementById('orangetheme') != null) document.getElementById('orangetheme').className = 'orangethemeon'; if (document.getElementById('mainbg') != null) document.getElementById('mainbg').className = 'container_content_mainpage mainbg_orange'; if (document.getElementById('container_advanced_search') != null) document.getElementById('container_advanced_search').className = 'advanced_search advsearch_orange'; if (document.getElementById('promo_text') != null) document.getElementById('promo_text').className = 'advanced_serach promo_text advsearch_orange'; // price table and pricing figures if (document.getElementById('price_table') != null) document.getElementById('price_table').className = 'price_table ptable_orange'; if (document.getElementById('pricefigure_cred') != null) document.getElementById('pricefigure_cred').className = 'pricefigure pfig_orange'; if (document.getElementById('pricefigure_subs') != null) document.getElementById('pricefigure_subs').className = 'pricefigure pfig_orange'; // drop menu background if (document.getElementById('dropMenu_imgcat') != null) document.getElementById('dropMenu_imgcat').className = 'dropMenu imgcat dropMenu_orange'; if (document.getElementById('dropMenu_photog') != null) document.getElementById('dropMenu_photog').className = 'dropMenu dropMenu_orange'; if (document.getElementById('dropMenu_langsite') != null) document.getElementById('dropMenu_langsite').className = 'dropMenu dropMenu_orange'; // blog var divArray = document.getElementsByTagName('div'); for (var i = 0; i < divArray.length; i++) { if (divArray[i].id == 'title_blog') divArray[i].className = 'title_blog title_blog_orange'; else if (divArray[i].id == 'blog_info_bar') divArray[i].className = 'bg_shades blog_info_bar bg_shades_orange'; else if (divArray[i].id == 'header_blog') divArray[i].className = 'header_blog header_blog_orange'; } break; case 'blue': case '': default: if (document.getElementById('logocolor') != null) document.getElementById('logocolor').className = 'logo logo_blue'; if (document.getElementById('sbarcolor') != null) document.getElementById('sbarcolor').className = 'container_search_bar sbar_blue'; if (document.getElementById('orangetheme') != null) document.getElementById('bluetheme').className = 'bluethemeon'; if (document.getElementById('mainbg') != null) document.getElementById('mainbg').className = 'container_content_mainpage mainbg_blue'; if (document.getElementById('container_advanced_search') != null) document.getElementById('container_advanced_search').className = 'advanced_search advsearch_blue'; if (document.getElementById('promo_text') != null) document.getElementById('promo_text').className = 'advanced_serach promo_text advsearch_blue'; // price table and pricing figures if (document.getElementById('price_table') != null) document.getElementById('price_table').className = 'price_table ptable_blue'; if (document.getElementById('pricefigure_cred') != null) document.getElementById('pricefigure_cred').className = 'pricefigure pfig_blue'; if (document.getElementById('pricefigure_subs') != null) document.getElementById('pricefigure_subs').className = 'pricefigure pfig_blue'; // drop menu background if (document.getElementById('dropMenu_imgcat') != null) document.getElementById('dropMenu_imgcat').className = 'dropMenu imgcat dropMenu_blue'; if (document.getElementById('dropMenu_photog') != null) document.getElementById('dropMenu_photog').className = 'dropMenu dropMenu_blue'; if (document.getElementById('dropMenu_langsite') != null) document.getElementById('dropMenu_langsite').className = 'dropMenu dropMenu_blue'; // blog var divArray = document.getElementsByTagName('div'); for (var i = 0; i < divArray.length; i++) { if (divArray[i].id == 'title_blog') divArray[i].className = 'title_blog title_blog_blue'; else if (divArray[i].id == 'blog_info_bar') divArray[i].className = 'bg_shades blog_info_bar bg_shades_blue'; else if (divArray[i].id == 'header_blog') divArray[i].className = 'header_blog header_blog_blue'; } break; case 'green': if (document.getElementById('logocolor') != null) document.getElementById('logocolor').className = 'logo logo_green'; if (document.getElementById('sbarcolor') != null) document.getElementById('sbarcolor').className = 'container_search_bar sbar_green'; if (document.getElementById('orangetheme') != null) document.getElementById('greentheme').className = 'greenthemeon'; if (document.getElementById('mainbg') != null) document.getElementById('mainbg').className = 'container_content_mainpage mainbg_green'; if (document.getElementById('container_advanced_search') != null) document.getElementById('container_advanced_search').className = 'advanced_search advsearch_green'; if (document.getElementById('promo_text') != null) document.getElementById('promo_text').className = 'advanced_serach promo_text advsearch_green'; // price table and pricing figures if (document.getElementById('price_table') != null) document.getElementById('price_table').className = 'price_table ptable_green'; if (document.getElementById('pricefigure_cred') != null) document.getElementById('pricefigure_cred').className = 'pricefigure pfig_green'; if (document.getElementById('pricefigure_subs') != null) document.getElementById('pricefigure_subs').className = 'pricefigure pfig_green'; // drop menu background if (document.getElementById('dropMenu_imgcat') != null) document.getElementById('dropMenu_imgcat').className = 'dropMenu imgcat dropMenu_green'; if (document.getElementById('dropMenu_photog') != null) document.getElementById('dropMenu_photog').className = 'dropMenu dropMenu_green'; if (document.getElementById('dropMenu_langsite') != null) document.getElementById('dropMenu_langsite').className = 'dropMenu dropMenu_green'; // blog var divArray = document.getElementsByTagName('div'); for (var i = 0; i < divArray.length; i++) { if (divArray[i].id == 'title_blog') divArray[i].className = 'title_blog title_blog_green'; else if (divArray[i].id == 'blog_info_bar') divArray[i].className = 'bg_shades blog_info_bar bg_shades_green'; else if (divArray[i].id == 'header_blog') divArray[i].className = 'header_blog header_blog_green'; } break; case 'silver': if (document.getElementById('logocolor') != null) document.getElementById('logocolor').className = 'logo logo_silver'; if (document.getElementById('sbarcolor') != null) document.getElementById('sbarcolor').className = 'container_search_bar sbar_silver'; if (document.getElementById('orangetheme') != null) document.getElementById('silvertheme').className = 'silverthemeon'; if (document.getElementById('mainbg') != null) document.getElementById('mainbg').className = 'container_content_mainpage mainbg_silver'; if (document.getElementById('container_advanced_search') != null) document.getElementById('container_advanced_search').className = 'advanced_search advsearch_silver'; if (document.getElementById('promo_text') != null) document.getElementById('promo_text').className = 'advanced_serach promo_text advsearch_silver'; // price table and pricing figures if (document.getElementById('price_table') != null) document.getElementById('price_table').className = 'price_table ptable_silver'; if (document.getElementById('pricefigure_cred') != null) document.getElementById('pricefigure_cred').className = 'pricefigure pfig_silver'; if (document.getElementById('pricefigure_subs') != null) document.getElementById('pricefigure_subs').className = 'pricefigure pfig_silver'; // drop menu background if (document.getElementById('dropMenu_imgcat') != null) document.getElementById('dropMenu_imgcat').className = 'dropMenu imgcat dropMenu_silver'; if (document.getElementById('dropMenu_photog') != null) document.getElementById('dropMenu_photog').className = 'dropMenu dropMenu_silver'; if (document.getElementById('dropMenu_langsite') != null) document.getElementById('dropMenu_langsite').className = 'dropMenu dropMenu_silver'; // blog var divArray = document.getElementsByTagName('div'); for (var i = 0; i < divArray.length; i++) { if (divArray[i].id == 'title_blog') divArray[i].className = 'title_blog title_blog_silver'; else if (divArray[i].id == 'blog_info_bar') divArray[i].className = 'bg_shades blog_info_bar bg_shades_silver'; else if (divArray[i].id == 'header_blog') divArray[i].className = 'header_blog header_blog_silver'; } break; case 'pink': if (document.getElementById('logocolor') != null) document.getElementById('logocolor').className = 'logo logo_pink'; if (document.getElementById('sbarcolor') != null) document.getElementById('sbarcolor').className = 'container_search_bar sbar_pink'; if (document.getElementById('orangetheme') != null) document.getElementById('pinktheme').className = 'pinkthemeon'; if (document.getElementById('mainbg') != null) document.getElementById('mainbg').className = 'container_content_mainpage mainbg_pink'; if (document.getElementById('container_advanced_search') != null) document.getElementById('container_advanced_search').className = 'advanced_search advsearch_pink'; if (document.getElementById('promo_text') != null) document.getElementById('promo_text').className = 'advanced_serach promo_text advsearch_pink'; // price table and pricing figures if (document.getElementById('price_table') != null) document.getElementById('price_table').className = 'price_table ptable_pink'; if (document.getElementById('pricefigure_cred') != null) document.getElementById('pricefigure_cred').className = 'pricefigure pfig_pink'; if (document.getElementById('pricefigure_subs') != null) document.getElementById('pricefigure_subs').className = 'pricefigure pfig_pink'; // drop menu background if (document.getElementById('dropMenu_imgcat') != null) document.getElementById('dropMenu_imgcat').className = 'dropMenu imgcat dropMenu_pink'; if (document.getElementById('dropMenu_photog') != null) document.getElementById('dropMenu_photog').className = 'dropMenu dropMenu_pink'; if (document.getElementById('dropMenu_langsite') != null) document.getElementById('dropMenu_langsite').className = 'dropMenu dropMenu_pink'; // blog var divArray = document.getElementsByTagName('div'); for (var i = 0; i < divArray.length; i++) { if (divArray[i].id == 'title_blog') divArray[i].className = 'title_blog title_blog_pink'; else if (divArray[i].id == 'blog_info_bar') divArray[i].className = 'bg_shades blog_info_bar bg_shades_pink'; else if (divArray[i].id == 'header_blog') divArray[i].className = 'header_blog header_blog_pink'; } break; } // remember theme var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('123theme', color, futdate, '/','.123rf.com'); } } // Cookies functions function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function remember_perpage(perpage) { // remember items per page var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000 // expires in 14 days (milliseconds) futdate.setTime(expdate); setCookie('perpage', perpage, futdate, '/','.123rf.com'); } var newWin = null; function popUp(strURL, strType, strHeight, strWidth) { if (newWin != null && !newWin.closed) newWin.close(); var strOptions=""; if (strType=="console") strOptions="resizable,height=" + strHeight+",width=" + strWidth; if (strType=="fixed") strOptions="status,height=" + strHeight+",width=" + strWidth; if (strType=="elastic") strOptions="toolbar,menubar,scrollbars," + "resizable,location,height="+ strHeight+",width="+strWidth; newWin = window.open(strURL, 'newWin', strOptions); newWin.focus(); } function toggle_colorpicker(color) { // var answer = window.open('http://www.123rf.com/colorpicker/?color=' + color,'ColorPicker','scalable=no,scrollbars=no,status=no,height=225,width=450,top=150,left=300'); if (searchform.colorrange != null) searchform.colorrange[2].checked = true; popUp('http://www.123rf.com/colorpicker/?color=' + color, 'fixed', 225, 450); return false; } function toggle_colorpicker_forum(color) { // var answer = window.open('http://forum.123rf.com/colorpicker/?color=' + color,'ColorPicker','scalable=no,scrollbars=no,status=no,height=225,width=450,top=150,left=300'); if (searchform.colorrange != null) searchform.colorrange[2].checked = true; popUp('http://forum.123rf.com/colorpicker/?color=' + color, 'fixed', 225, 450); return false; } function removecolor() { if (document.getElementById('colorpicker') != null) document.getElementById('colorpicker').style.background = '#AAAAAA'; if (document.getElementById('colorhex') != null) document.getElementById('colorhex').value = ''; // if (document.getElementById('hsv') != null) document.getElementById('hsv').value = ''; if (document.getElementById('colorpicker_text') != null) document.getElementById('colorpicker_text').innerHTML = 'No color preference'; } // process and combine all keywords into function process_kw(count, type) { var string_kw = ''; var count_checked = 0; var chkbox_kw; for (var i = 0; i <= count; i++) { // alert("document.form_searchkw.kw_" + i); if (type == '123') chkbox_kw = eval("document.form_searchkw.kw_" + i); else if (type == 'inm') chkbox_kw = eval("document.form_searchkw_inm.kw_inm_" + i); if (chkbox_kw) { if (chkbox_kw.checked) { // alert(chkbox_kw.value); if (string_kw == '') string_kw = string_kw + chkbox_kw.value; else string_kw = string_kw + '_' + chkbox_kw.value; count_checked++; } } } // alert(string_kw); if (!count_checked) alert('Please check at least one keyword and try again.'); else { if (type == '123') window.location = '/stock-photo/' + string_kw + '.html'; // if (type == 'inm') window.parent.location = 'http://www.inmagine.com/searchterms/' + string_kw + '.html'; if (type == 'inm') window.open('http://www.inmagine.com/searchterms/' + string_kw + '.html'); } } // var answer = window.open('http://www.123rf.com/reportspam.php,'ColorPicker','scalable=no,scrollbars=no,status=no,height=225,width=450,top=150,left=300'); function $(v) { return(document.getElementById(v)); } function $S(v) { return($(v).style); } function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); } function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); } function XYwin(v) { var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); return(isset(v)?z[v]:z); } function getY( oElement ) { var iReturnValue = 0; while( oElement != null ) { iReturnValue += oElement.offsetTop; oElement = oElement.offsetParent; } return iReturnValue; } function sexyTOG() {$S('sexyBG').display='none'; $S('sexyBOX').display='none';} function sexyBOX(v,b) { setTimeout("sexyTOG()",8000); $S('sexyBG').height=(XYwin(0)*2.5)+'px'; $S('sexyBG').display='block'; $('sexyBOX').innerHTML=v+'

  Preparing for your download...

'+"<\/div>"; $S('sexyBOX').left=Math.round((XYwin(1)-b)/2)+'px'; $S('sexyBOX').width=b+'px'; $S('sexyBOX').display='block'; } window.Blink = function(args){ // Set the color and seconds below, e.g., [args,'COLOR',SECONDS] args = (/,/.test(args))? args.split(/,/): [args,'#FFFF88',6]; var who = document.getElementById(args[0]); var count = parseInt(args[2]); if (--count <=0) { who.style.backgroundColor = ''; if(who.focus) who.focus(); } else { args[2]=count+''; who.style.backgroundColor=(count%2==0)? '': args[1]; args='\"'+args.join(',')+'\"'; setTimeout("Blink("+args+")",500); } } function tog_keywords(key,todo) { //var keywordid = "keyword_"+key; var s; var e; var addkeyword = "add_"+key; var deletekeyword = "delete_"+key; if (todo=='add') { //if click add if (document.getElementById(addkeyword).src == 'http://www.123rf.com/image/icons/add.gif') { //if already added, then remove document.getElementById(addkeyword).src = 'http://www.123rf.com/image/icons/add_grey.gif'; s=" "+document.searchform.word.value+" "; s=s.replace(new RegExp(" ", "g")," "); s=s.replace(new RegExp(" "+key+" ", "g")," "); s=s.replace(new RegExp(" ", "g")," "); } else { //if not added, then add, and remove from exclude word s=document.searchform.word.value + " " + key; document.getElementById(addkeyword).src = 'http://www.123rf.com/image/icons/add.gif'; document.getElementById(deletekeyword).src = 'http://www.123rf.com/image/icons/delete_grey.gif'; e=" "+document.searchform.exclude.value+" "; e=e.replace(new RegExp(" ", "g")," "); e=e.replace(new RegExp(" "+key+" ", "g")," "); e=e.replace(new RegExp(" ", "g")," "); document.searchform.exclude.value = e.replace(/^\s+|\s+$/g,""); } document.searchform.word.value = s.replace(/^\s+|\s+$/g,""); } else { //if delete if (document.getElementById(deletekeyword).src == 'http://www.123rf.com/image/icons/delete.gif') { //if already in exclude, then remove from exclude document.getElementById(deletekeyword).src = 'http://www.123rf.com/image/icons/delete_grey.gif'; e=" "+document.searchform.exclude.value+" "; e=e.replace(new RegExp(" ", "g")," "); e=e.replace(new RegExp(" "+key+" ", "g")," "); e=e.replace(new RegExp(" ", "g")," "); } else { //if not in exclude, add into exclude, and remove from search e=document.searchform.exclude.value + " " + key; document.getElementById(deletekeyword).src = 'http://www.123rf.com/image/icons/delete.gif'; document.getElementById(addkeyword).src = 'http://www.123rf.com/image/icons/add_grey.gif'; s=" "+document.searchform.word.value+" "; s=s.replace(new RegExp(" ", "g")," "); s=s.replace(new RegExp(" "+key+" ", "g")," "); s=s.replace(new RegExp(" ", "g")," "); document.searchform.word.value = s.replace(/^\s+|\s+$/g,""); } document.searchform.exclude.value = e.replace(/^\s+|\s+$/g,""); } document.searchform.submit(); } // new magnify functions using cache servers (v3) function magnifyme(supplier_name, image_id, width, height) { if (!window.cacheserver || cacheserver == '') cacheserver = 'http://sg.123rf.com'; //var imgsrc = cacheserver + '/400wm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; var imageid = "i_"+image_id; var image_desc = document.getElementById(image_id).getAttribute('alt'); if (image_desc == null) {image_desc = '';} var imgsrc = document.getElementById(image_id).getAttribute('src'); imgsrc = imgsrc.replace(new RegExp("168nwm", "g"),"400wm"); //modified by js if (width == 0) var imgdiv = ''; else var imgdiv = ''; //by lh //if (width == 0 || height ==0) var imgdiv = ''; //else var imgdiv = ''; var imgdesc = '
' + image_desc + '
'; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgdesc + imgphotog, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // if (width == 0 || height == 0) return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // else return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // return overlib('', HAUTO, VAUTO, BGCOLOR, '#AAAAAA', FGCOLOR, '#AAAAAA'); } // new magnify functions using cache servers (v4) includes watermark position by JS function magnifymev4(supplier_name, image_id, width, height,wmx,wmy) { if (!window.cacheserver || cacheserver == '') cacheserver = 'http://sg.123rf.com'; //var imgsrc = cacheserver + '/400wm/' + supplier_name + '/' + cd_code + '/' + file_name + '.jpg'; var imageid = "i_"+image_id; var image_desc = document.getElementById(image_id).getAttribute('alt'); if (image_desc == null) {image_desc = '';} var imgsrc = document.getElementById(image_id).getAttribute('src'); imgsrc = imgsrc.replace(new RegExp("168nwm", "g"),"400wm/"+wmx+"/"+wmy); //modified by js if (width == 0) var imgdiv = ''; else var imgdiv = ''; //by lh //if (width == 0 || height ==0) var imgdiv = ''; //else var imgdiv = ''; var imgdesc = '
' + image_desc + '
'; var imgphotog = '
Photographer' + supplier_name + '
'; return overlib(imgdiv + imgdesc + imgphotog, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // if (width == 0 || height == 0) return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // else return overlib('' + image_desc, ABOVE, HAUTO, VAUTO, BGCOLOR, '#888888', FGCOLOR, '#888888'); // return overlib('', HAUTO, VAUTO, BGCOLOR, '#AAAAAA', FGCOLOR, '#AAAAAA'); } // October 29, 2007 // New functions on the new design in 2007 // Some ported from inmagine.com function toggle_advancedsearch (id_to_show) { var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000; // expires in 30 days (milliseconds) futdate.setTime(expdate); if (document.getElementById('top_search_panel_uni') != null) document.getElementById('top_search_panel_uni').style.display = 'none'; if (document.getElementById('g_lang_uni') != null) document.getElementById('g_lang_uni').style.display = 'none'; if (document.getElementById('search_win_brand') && document.getElementById('search_win_brand').style.display == "none") { document.getElementById('search_win_brand').style.display = 'block'; } if (document.getElementById('google_branding') && document.getElementById('google_branding') != "none") { document.getElementById('google_branding').style.display = 'none'; } document.getElementById("searchform").action = "search.php"; if (id_to_show == 'basic_search') { var answer = confirm(lang_switchsearch); if (answer) { resetsearch(); if (document.getElementById('top_search_left_border') != null) document.getElementById('top_search_left_border').className = 'top_search_left_border_bsc'; if (document.getElementById('advanced_search_options') != null) document.getElementById('advanced_search_options').style.display = 'none'; if (document.getElementById('top_search_panel_bsc') != null) document.getElementById('top_search_panel_bsc').style.display = 'block'; if (document.getElementById('top_search_panel_adv') != null) document.getElementById('top_search_panel_adv').style.display = 'none'; if (document.getElementById('icon_searchmax') != null) document.getElementById('icon_searchmax').style.display = 'none'; if (document.getElementById('icon_searchmin') != null) document.getElementById('icon_searchmin').style.display = 'none'; if (document.getElementById('searchrm_option') != null) document.getElementById('searchrm_option').style.display = 'inline'; setCookie('advsearchdisplay_new', 'none', futdate, '/', '.123rf.com'); } } else if (id_to_show == 'adv_search_max') { if (document.getElementById('top_search_left_border') != null) document.getElementById('top_search_left_border').className = 'top_search_left_border_adv'; if (document.getElementById('advanced_search_options') != null) document.getElementById('advanced_search_options').style.display = 'block'; if (document.getElementById('top_search_panel_bsc') != null) document.getElementById('top_search_panel_bsc').style.display = 'none'; if (document.getElementById('top_search_panel_adv') != null) document.getElementById('top_search_panel_adv').style.display = 'block'; if (document.getElementById('icon_searchmax') != null) document.getElementById('icon_searchmax').style.display = 'none'; if (document.getElementById('icon_searchmin') != null) document.getElementById('icon_searchmin').style.display = 'block'; if (document.getElementById('searchrm_option') != null) document.getElementById('searchrm_option').style.display = 'none'; setCookie('advsearchdisplay_new', 'block', futdate, '/', '.123rf.com'); setCookie('hide_adv_options', '0', futdate, '/', '.123rf.com'); } else if (id_to_show == 'adv_search_min') { if (document.getElementById('top_search_left_border') != null) document.getElementById('top_search_left_border').className = 'top_search_left_border_adv'; if (document.getElementById('advanced_search_options') != null) document.getElementById('advanced_search_options').style.display = 'none'; if (document.getElementById('top_search_panel_bsc') != null) document.getElementById('top_search_panel_bsc').style.display = 'none'; if (document.getElementById('top_search_panel_adv') != null) document.getElementById('top_search_panel_adv').style.display = 'block'; if (document.getElementById('icon_searchmax') != null) document.getElementById('icon_searchmax').style.display = 'block'; if (document.getElementById('icon_searchmin') != null) document.getElementById('icon_searchmin').style.display = 'none'; if (document.getElementById('searchrm_option') != null) document.getElementById('searchrm_option').style.display = 'none'; setCookie('advsearchdisplay_new', 'block', futdate, '/', '.123rf.com'); setCookie('hide_adv_options', '1', futdate, '/', '.123rf.com'); } } function show_showAdvOptionButton () { if (document.getElementById('icon_searchmax') != null) document.getElementById('icon_searchmax').style.display = 'block'; } function show_hideAdvOptionButton () { if (document.getElementById('icon_searchmin') != null) document.getElementById('icon_searchmin').style.display = 'block'; } function toggle_designphotog (target) { var futdate = new Date(); var expdate = futdate.getTime(); expdate += 14 * 24 * 3600 * 1000; // expires in 14 days (milliseconds) futdate.setTime(expdate); if (target == 'design') { if (document.getElementById('tab_designer') != null) document.getElementById('tab_designer').style.display = 'block'; if (document.getElementById('tab_photog') != null) document.getElementById('tab_photog').style.display = 'none'; if (document.getElementById('tabopt_designer') != null) document.getElementById('tabopt_designer').style.display = 'block'; if (document.getElementById('tabopt_photog') != null) document.getElementById('tabopt_photog').style.display = 'none'; if (document.getElementById('tabopt2_designer1') != null) document.getElementById('tabopt2_designer1').style.display = 'block'; if (document.getElementById('tabopt2_photog1') != null) document.getElementById('tabopt2_photog1').style.display = 'none'; if (document.getElementById('tabopt2_designer2') != null) document.getElementById('tabopt2_designer2').style.display = 'block'; if (document.getElementById('tabopt2_photog2') != null) document.getElementById('tabopt2_photog2').style.display = 'none'; setCookie('tabpref', 'design', futdate, '/', '.123rf.com'); } else if (target == 'photog') { if (document.getElementById('tab_designer') != null) document.getElementById('tab_designer').style.display = 'none'; if (document.getElementById('tab_photog') != null) document.getElementById('tab_photog').style.display = 'block'; if (document.getElementById('tabopt_designer') != null) document.getElementById('tabopt_designer').style.display = 'none'; if (document.getElementById('tabopt_photog') != null) document.getElementById('tabopt_photog').style.display = 'block'; if (document.getElementById('tabopt2_designer1') != null) document.getElementById('tabopt2_designer1').style.display = 'none'; if (document.getElementById('tabopt2_photog1') != null) document.getElementById('tabopt2_photog1').style.display = 'block'; if (document.getElementById('tabopt2_designer2') != null) document.getElementById('tabopt2_designer2').style.display = 'none'; if (document.getElementById('tabopt2_photog2') != null) document.getElementById('tabopt2_photog2').style.display = 'block'; setCookie('tabpref', 'photog', futdate, '/', '.123rf.com'); } } function show_contact_popup() { if (document.getElementById('top_contact_list') != null) document.getElementById('top_contact_list').style.display = 'block'; if (document.getElementById('lang_option_list') != null) document.getElementById('lang_option_list').style.display = 'none'; } function show_lang_popup() { if (document.getElementById('lang_option_list')) document.getElementById('lang_option_list').style.display = 'block'; if (document.getElementById('top_contact_list')) document.getElementById('top_contact_list').style.display = 'none'; } function hide_searching_icon() { if (document.getElementById('icon_searching') != null) { document.getElementById('icon_searching').style.display = 'none'; } } function show_searching_icon() { if (document.getElementById('icon_searching') != null) { document.getElementById('icon_searching').style.display = 'block'; } } function backToTop() { var x1 = x2 = x3 = 0; var y1 = y2 = y3 = 0; if (document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0; } if (document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0; } x3 = window.scrollX || 0; y3 = window.scrollY || 0; var x = Math.max(x1, Math.max(x2, x3)); var y = Math.max(y1, Math.max(y2, y3)); // alert(x + ', ' + y); if (document.getElementById('zip') != null) { var zip = document.getElementById('zip'); var x4 = zip.scrollLeft || 0; var y4 = zip.scrollTop || 0; var x = Math.max(x, x4); var y = Math.max(y, y4); document.getElementById('zip').scrollTop = Math.floor(y / 2); document.getElementById('zip').scrollLeft = Math.floor(x / 2); } window.scrollTo(Math.floor(x / 2), Math.floor(y / 2)); // document.getElementById('zip').scrollLeft(Math.floor(x / 2)); // document.getElementById('zip').scrollTop(Math.floor(y / 2)); // window.scrollTo(Math.floor(x / 2), Math.floor(y / 2)); if (x > 0 || y > 0) { backToTop(); // window.setTimeout("backToTop()", 25); } } function sortSearchResult(searchOpt) { document.sortform.orderby.value = searchOpt; document.sortform.submit(); } function switch_cat_tab(viewtype) { // remember items per page var futdate = new Date(); var expdate = futdate.getTime(); if(viewtype == ""){ expdate -= 7 * 24 * 3600 * 1000 // remove cookie } else { expdate += 7 * 24 * 3600 * 1000 // expires in 7 days (milliseconds) } futdate.setTime(expdate); setCookie('searchactivetab', viewtype, futdate, '/','.123rf.com'); // document.location = refreshURL; } function show_am_list() { var div_am = document.getElementById('div_am'); if (div_am != null) div_am.style.display = ''; } function hide_am_list() { var div_am = document.getElementById('div_am'); if (div_am != null) div_am.style.display = 'none'; }