function generate_portfolio_categories(){ delete changesjax; var changesjax; try{ changesjax = new XMLHttpRequest(); } catch (e){ try{ changesjax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ changesjax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } changesjax.onreadystatechange = function(){ if(changesjax.readyState == 4){ final_results = changesjax.responseText; var popup_div = document.getElementById("portfolio_categories_popup"); if(isIE()){ popup_div.style.top = document.body.scrollTop; }else{ popup_div.style.top = window.pageYOffset; } popup_div.innerHTML = final_results; } } var queryString = "op=generate_portfolio_categories"; changesjax.open("POST", "http://www.orenusa.com/modules/portfolio/portfolio.php", true); changesjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); changesjax.setRequestHeader("Content-length", queryString.length); changesjax.setRequestHeader("Connection", "close"); changesjax.send(queryString); } function exit_portfolio_categories() { var popup_div = document.getElementById("portfolio_categories_popup"); popup_div.innerHTML=''; } function pop_gallery_div(category, portfolio, id_image) { blackout_visible('in'); if(isIE()){ setTimeout("blackout_fade(10);", 75); setTimeout("blackout_fade(20);", 150); setTimeout("blackout_fade(30);", 225); setTimeout("blackout_fade(40);", 300); setTimeout("blackout_fade(50);", 375); setTimeout("blackout_fade(60);", 450); setTimeout("blackout_fade(70);", 525); setTimeout("blackout_fade(80);", 600); }else{ setTimeout("blackout_fade(.1);", 75); setTimeout("blackout_fade(.2);", 150); setTimeout("blackout_fade(.3);", 225); setTimeout("blackout_fade(.4);", 300); setTimeout("blackout_fade(.5);", 375); setTimeout("blackout_fade(.6);", 450); setTimeout("blackout_fade(.7);", 525); setTimeout("blackout_fade(.8);", 600); } setTimeout("execute_popup('"+category+"','"+portfolio+"');", 600); setTimeout("next_image("+id_image+");", 1000); } function pop_next_gallery(category, portfolio, id_image) { next_image(id_image); load_new_gallery_information(category, portfolio, id_image, 1); } function load_new_gallery_information(category, portfolio, id_image, step) { delete changesjax; var changesjax; try{ changesjax = new XMLHttpRequest(); } catch (e){ try{ changesjax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ changesjax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } changesjax.onreadystatechange = function(){ if(changesjax.readyState == 4){ //This function is just to send vars to be inserted into mysql dbs thus it returns nothing... final_results = changesjax.responseText; if(step == 1) { var popup_div = document.getElementById("gallery_declaration_information"); popup_div.innerHTML = final_results; load_new_gallery_information(category, portfolio, id_image, 2); } else if(step == 2) { var popup_div = document.getElementById("project_navigation"); popup_div.innerHTML = final_results; load_new_gallery_information(category, portfolio, id_image, 3); } else if(step == 3) { var popup_div = document.getElementById("project_title_span"); popup_div.innerHTML = final_results; } } } if(step == 1) var queryString = "category="+category+"&portfolio="+portfolio+"&load_description=1"; else if(step == 2) var queryString = "category="+category+"&portfolio="+portfolio+"&load_next_prev_only=1"; else if(step == 3) var queryString = "category="+category+"&portfolio="+portfolio+"&load_title_only=1"; changesjax.open("POST", "http://www.orenusa.com/modules/portfolio/display_portfolio_project.php", true); changesjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); changesjax.setRequestHeader("Content-length", queryString.length); changesjax.setRequestHeader("Connection", "close"); changesjax.send(queryString); } function load_new_next_prev_image(category, portfolio, image, step){ delete changesjax; var changesjax; try{ changesjax = new XMLHttpRequest(); } catch (e){ try{ changesjax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ changesjax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } changesjax.onreadystatechange = function(){ if(changesjax.readyState == 4){ //This function is just to send vars to be inserted into mysql dbs thus it returns nothing... final_results = changesjax.responseText; if(step == 1) { var popup_div = document.getElementById("portfolio_prev_image"); popup_div.innerHTML = final_results; load_new_next_prev_image(category, portfolio, image, 2); } else if(step == 2) { var popup_div = document.getElementById("portfolio_next_image"); popup_div.innerHTML = final_results; } } } if(step == 1) var queryString = "category="+category+"&portfolio="+portfolio+"&id_image="+image+"&show_next_prev_image_only=1"; else if(step == 2) var queryString = "category="+category+"&portfolio="+portfolio+"&id_image="+image+"&show_next_prev_image_only=2"; changesjax.open("POST", "http://www.orenusa.com/modules/portfolio/display_portfolio_project.php", true); changesjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); changesjax.setRequestHeader("Content-length", queryString.length); changesjax.setRequestHeader("Connection", "close"); changesjax.send(queryString); } function execute_popup(category, portfolio){ delete changesjax; var changesjax; try{ changesjax = new XMLHttpRequest(); } catch (e){ try{ changesjax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ changesjax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } changesjax.onreadystatechange = function(){ if(changesjax.readyState == 4){ //This function is just to send vars to be inserted into mysql dbs thus it returns nothing... final_results = changesjax.responseText; var popup_div = document.getElementById("portfolio_popup"); if(isIE()){ popup_div.style.top = document.body.scrollTop; }else{ popup_div.style.top = window.pageYOffset; } popup_div.innerHTML = final_results; popup_div.style.display = "block"; } } var queryString = "category="+category+"&portfolio="+portfolio; changesjax.open("POST", "http://www.orenusa.com/modules/portfolio/display_portfolio_project.php", true); changesjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); changesjax.setRequestHeader("Content-length", queryString.length); changesjax.setRequestHeader("Connection", "close"); changesjax.send(queryString); } function blackout_visible(direction) { if(direction == 'in'){ if(isIE()){ document.getElementById("blackout_div").filters.alpha.opacity = 0; }else{ document.getElementById("blackout_div").style.opacity = 0; } if (window.innerHeight && window.scrollMaxY) {// Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } document.getElementById("blackout_div").style.height = yWithScroll; document.getElementById("blackout_div").style.display = "block"; } else { document.getElementById("blackout_div").style.height = 0; document.getElementById("blackout_div").style.display = "none"; } } function blackout_fade(amt) { var bkout = document.getElementById("blackout_div"); if(isIE()){ bkout.filters.alpha.opacity = amt; }else{ bkout.style.opacity = amt; } } function exit_portfolio () { var popup_div = document.getElementById("portfolio_popup"); popup_div.style.display='none'; if(isIE()){ setTimeout("blackout_fade(60);", 75); setTimeout("blackout_fade(50);", 150); setTimeout("blackout_fade(40);", 225); setTimeout("blackout_fade(30);", 300); setTimeout("blackout_fade(20);", 375); setTimeout("blackout_fade(10);", 450); setTimeout("blackout_fade(0);", 525); }else{ setTimeout("blackout_fade(.6);", 75); setTimeout("blackout_fade(.5);", 150); setTimeout("blackout_fade(.4);", 225); setTimeout("blackout_fade(.3);", 300); setTimeout("blackout_fade(.2);", 375); setTimeout("blackout_fade(.1);", 450); setTimeout("blackout_fade(0.0);", 525); } setTimeout("blackout_visible('out');", 525); } function isIE(){ return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent); } function next_image(image_num){ var image_url = all_images_url[image_num]; var width = all_images_width[image_num]; var height = all_images_height[image_num]; if(!document.getElementById("resizercontainer")) { setTimeout("next_image("+image_num+");", 250); return false; } animElements = document.getElementById("resizercontainer"); if (!animElements.currentWidth) animElements.currentWidth = 200; //if no mem is set, set it first; if (!animElements.currentHeight) animElements.currentHeight = 200; //if no mem is set, set it first; clearInterval(animElements.active_loop); active_step = 0; animElements.active_loop = setInterval("loop_steps('"+height+"','"+width+"','"+image_url+"','"+image_num+"');", 50); } var temp_load_image; function loop_steps(target_height,target_width,image_url,image_num){ animElements = document.getElementById("resizercontainer"); imageElement = document.getElementById("swap_image"); if(active_step == 0){ temp_load_image = new Image; temp_load_image.src = image_url; active_step = 1; }else if(active_step == 1){ if(isIE()){ if(imageElement.filters.alpha.opacity > 0){ // keep fading the old image out imageElement.filters.alpha.opacity = imageElement.filters.alpha.opacity - 10; }else{ imageElement.src = image_url; active_step = 2; } }else{ if(imageElement.style.opacity*1 > 0){ // keep fading the old image out imageElement.style.opacity = imageElement.style.opacity*1 - .1; }else{ imageElement.src = image_url; active_step = 2; } } }else if(active_step == 2){ doDimensionChangeMem(animElements,animElements.currentWidth,target_width,25,10,0.35,'width'); active_step = 3; }else if(active_step == 3){ if(animElements.currentWidth == target_width){ doDimensionChangeMem(animElements,animElements.currentHeight,target_height,25,10,0.35,'height'); active_step = 6; } }else if(active_step == 6){ if (temp_load_image.complete){ imageElement.src = temp_load_image.src; active_step = 4; } }else if(active_step == 4){ if(animElements.currentHeight == target_height){ if(isIE()){ if(imageElement.filters.alpha.opacity < 100){ // keep fading the old image out imageElement.filters.alpha.opacity = imageElement.filters.alpha.opacity + 10; }else{ active_step = 5; } }else{ if(imageElement.style.opacity*1 < 1){ // keep fading the old image out imageElement.style.opacity = imageElement.style.opacity*1 + .1; }else{ active_step = 5; } } } }else if(active_step == 5){ clearInterval(animElements.active_loop); active_step = 0; } } //// if powr > 1 functions starts slow and ends fast, function doDimensionChangeMem(elem,startDimension,endDimension,steps,intervals,powr,dimension) { if(dimension == 'width'){ if (elem.widthChangeMemInt) { window.clearInterval(elem.widthChangeMemInt); } var actStep = 0; elem.widthChangeMemInt = window.setInterval( function() { elem.currentWidth = easeInOut(startDimension,endDimension,steps,actStep,powr); //document.getElementById('width').innerHTML = elem.currentWidth; elem.style.width = elem.currentWidth+"px"; actStep++; if (actStep > steps) window.clearInterval(elem.widthChangeMemInt); } ,intervals) }else if(dimension == 'height'){ if (elem.heightChangeMemInt) { window.clearInterval(elem.heightChangeMemInt); } var actStep = 0; elem.heightChangeMemInt = window.setInterval( function() { elem.currentHeight = easeInOut(startDimension,endDimension,steps,actStep,powr); //document.getElementById('height').innerHTML = elem.currentHeight; elem.style.height = elem.currentHeight+"px"; actStep++; if (actStep > steps) window.clearInterval(elem.heightChangeMemInt); } ,intervals) } } function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) { var delta = maxValue - minValue; var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta); return Math.ceil(stepp) } function scrollGalleryDiv(dir){ var scroll_div = document.getElementById('gallery_scrolling_div'); if(dir=='right'){ scroll_div.scrollLeft+=3; }else if(dir=='left'){ scroll_div.scrollLeft-=3; } }