﻿function Page_Load(){    
    Body_Resize();
    if(page == 'contact-us'){
        Map_Load();    
    }
    var x = '1';
    switch(page){
        case 'portfolio':
            x=4;
            break;
        case 'contact-us':
            x=2;
            break;
        case 'about':
            x=1;
            break;
      //  case 'home':
          //  x=1;
         //   break;
        default:
            x = Math.ceil(4*Math.random());
            break;
        
    }
    document.body.style.backgroundImage = 'url(images/bg'+x+'.jpg)';   
}
function Body_Resize(){
    var w = g("m").clientWidth;
    var h = g("m").clientHeight;
    g("i").style.width = w;
    switch (page) {
        case 'portfolio':
            g("bi").style.height = 1600;
            break;
        case 'home':
            break;
        case 'about':
            g("bi").style.height = 780;
            break;
        default:
            g("bi").style.height = h - 85;
            break;

    }
   
   
}
function g(obj){
    return document.getElementById(obj);
}
function f(){
    var a = '';
    if( g('NAME').value == '' ){
        a += 'name is required\n';
    }
    if( g('EMAIL').value == '' ){
        a += 'email is required\n';
    }
    if( g('PHONE').value == '' ){
        a += 'phone is required\n';
    }
    if( g('MESSAGE').value == '' ){
        a += 'message is required\n';
    }
    if( a != '' ){
        alert(a);
        return false;
    }
    return true;
    
}
function Map_Load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(47.584858, -122.333692), 13, G_PHYSICAL_MAP);
    var point = new GLatLng(47.584858, -122.333692)
    var opts = new Object(); 
    opts.title = "Click for full sized map"; 
    var marker = new GMarker(point, opts)
    map.addOverlay(marker);
    map.addControl(new GLargeMapControl()); 

    GEvent.addListener(marker, "click", function() {window.open('http://maps.google.com/maps?hl=en&ie=UTF8&q=ryan+rhodes&near=Seattle,+WA&fb=1&cid=15027634192802468091&li=lmd&ll=47.65475,-122.357483&spn=0.03388,0.079479&z=14&iwloc=A');});
  }
}