function hide_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.className=node.className.replace('showed', '');
        node.className += ' hidden';
    }
}

function show_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.className=node.className.replace('hidden', '');
        node.className += ' showed';
    }
}

function toggle_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        if (node.className.indexOf('hidden') != -1)
            node.className=node.className.replace('hidden', 'showed')
        else if (node.className.indexOf('showed') != -1)
            node.className=node.className.replace('showed', 'hidden')
        else node.className += ' showed';
     }
}

function setPrintCSS(isPrint) {
  if (document.getElementsByTagName)
      x = document.getElementsByTagName('link');
  else
  {
      return;
  }
  for (var i=0;i<x.length;i++) {
      if(x[i].title == 'printview'){x[i].disabled = !isPrint;}
      if(x[i].title == 'screenview'){x[i].disabled = isPrint;}
  }
}

function moveHintsN(e)
{
	document.getElementById('hints').style.visibility = "visible";
	var z = [];
	if (!e) e = event;
	if (e.pageX)
		{
			z['left'] = e.pageX ;
			z['top'] = e.pageY-20;
		}
		else
		{
			z['left'] = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			z['top'] = e.clientY + document.body.scrollTop + document.documentElement.scrollTop - 20;
		}
			z['height'] = 30;
			z['width'] = 20;
	setPosition(document.getElementById('hints'), z);
}



function hideHintsN(e)
{
	document.onmousemove = null;
	document.onmouseout = null;
    document.getElementById('hints').style.visibility = "hidden";
}

function showHints(text, el)
{
	if (text == "") return;
	document.getElementById('hints').innerHTML = text;
	document.onmousemove = moveHintsN;
	document.onmouseout = hideHintsN;
}
function getBounds(tElement)
{
	var left = tElement.offsetLeft,
		top = tElement.offsetTop,
		parent;

	for (parent = tElement.offsetParent; parent; parent = parent.offsetParent)
	{
		left += parent.offsetLeft;
		top += parent.offsetTop;
	}
	return {left: left, top: top, width: tElement.offsetWidth, height: tElement.offsetHeight};
}

function setPosition()
{
	var scrollTop = document.documentElement.scrollTop,
		tElement = arguments[0],
		tBounds = arguments[1],
		w = tElement.clientWidth,
		h = tElement.clientHeight,
		winW = document.documentElement.clientWidth,
		winH = document.documentElement.clientHeight,
		vPX = 0,
		tHeightNotSet = true;

	if ((w + tBounds.left > winW) && (winW - w + tBounds.left > w))
		tElement.style.left = tBounds.left - w + tBounds.width + 'px';
	else
		tElement.style.left = tBounds.left + 'px';

	if (h + tBounds.top > winH + scrollTop)
	{
		if (h - tBounds.top > 0)
			if (h + tBounds.top - winH - scrollTop > h - tBounds.top)
				tHeightNotSet = false;
	}

	if ((tBounds.top + h > winH + scrollTop) && tHeightNotSet)
		if (tBounds.top - h - scrollTop > 0)
			tHeightNotSet = false;

	if ((winH - tBounds.top + scrollTop - h - tBounds.height < 0) && (tBounds.top - scrollTop - h > winH - tBounds.top + scrollTop - h - tBounds.height))
		tHeightNotSet = false;
//alert(tBounds.height);
	if (tHeightNotSet)
		tElement.style.top = tBounds.top + tBounds.height + vPX + 'px';
	else
		tElement.style.top = tBounds.top - h - vPX + 'px';
}




function validateForm(e) {

var f = '#' + $(e).attr('id');
var elem = $(f + " input, " + f + ' textarea,' + f + ' select,');


var err = "";

for (var i=0; i<elem.length; i++) {

    if ($(elem[i]).hasClass("required") && $(elem[i]).get(0).tagName == 'INPUT' && $(elem[i]).val() == "")
    {
      err += "<li><strong>"+ $(elem[i]).attr("placeholder") +"</strong> - required to be filled</li>";
	  $(elem[i].parentNode).addClass('error');
    }
	else
	{
		 $(elem[i].parentNode).removeClass('error');
		  $(elem[i].parentNode).addClass('ok');
	}
    if ($(elem[i]).hasClass("required") && $(elem[i]).get(0).tagName == 'TEXTAREA' && $(elem[i]).val() == "")
    {
      err += "<li><strong>"+ $(elem[i]).attr("placeholder") +"</strong> - required to be filled</li>";
	  $(elem[i].parentNode).addClass('error');
    }
	else
	{
		  $(elem[i].parentNode).addClass('ok');
	}	

	if ($(elem[i]).hasClass("email") && $(elem[i]).val() !== "" )
    {
		if (!checkEmail($(elem[i]).val()) )
		{
		  err += "<li><strong>"+ $(elem[i]).attr("placeholder") +"</strong> - must be valid</li>";
		  $(elem[i].parentNode).addClass('error');
		  $(elem[i].parentNode).removeClass('ok');
		}
		else
		{
			  $(elem[i].parentNode).addClass('ok');
		}

	}

	if ($(elem[i]).hasClass("required") && $(elem[i]).get(0).tagName == 'SELECT' && (elem[i].selectedIndex <= 0))
    {
      err += "<li><strong>"+ $(elem[i]).attr("placeholder") +"</strong> - necessarily need to choose</li>";
	  $(elem[i].parentNode).addClass('error');
	  $(elem[i].parentNode).removeClass('ok');

	}


	if ($(elem[i]).hasClass("phone") && $(elem[i]).val() !== "" )
    {
		if (!checkPhone($(elem[i]).val()) )
		{
		  err += "<li><strong>"+ $(elem[i]).attr("placeholder") +"</strong> - must be valid</li>";
		  $(elem[i].parentNode).addClass('error');
		  $(elem[i].parentNode).removeClass('ok');
		}
		else
		{
			  $(elem[i].parentNode).addClass('ok');
		}

	}

  }
  if (err != "") {
    err = "<span>You forgot or did not correctly enter one or more fields. Please correct these errors:</span><ul>" + err + "</ul>";
    $("#fill_form").html(err).addClass("visible");
    return false;
  }
  else return true;
}


/* --========================--*/
function checkEmail(e)
{
 ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

 for(i=0; i < e.length ;i++)
  if(ok.indexOf(e.charAt(i))<0)
   return (false);

 if (document.images)
 {
  re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
  re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!e.match(re) && e.match(re_two))
   return true;
  else
   return false;

 }
 return true;

}

function checkPhone(e)
{
	if(e.match(/^\+?[0-9\- ]{5,}$/))
		return true
	else
   		return false;
}

function elementSupportsAttribute(element,attribute) {
	var test = document.createElement(element);
	if (attribute in test) {
		return true;
	} else {
		return false;
	}
}

/**
* LightGallery v1.3
* Author: Dmitri Ischenko ischenkodv@gmail.com
* Freely distributable under MIT-style license
* Patched by iDeus.biz
*/
var lightgallery=(function(){var h,g,c,a,H,ad,J={showOverlay:true,overlayColor:"#000",overlayOpacity:0.85,zoomStep:0.2,animate:true,framesNumber:20,speed:30,resizeSync:false,enableZoom:true,fadeImage:true,alias:"lightgallery",fullSize:false,minPadding:15},al={next:"Next",prev:"Previous",zoomIn:"Zoom In",zoomOut:"Zoom Out",fullSize:"Full Size",fitScreen:"Fit screen",close:"Close",image:"Image",of:"of"},p,T,Q,s,L,b,k,x,l,aj,d,B,w,ai,af="hidden",am="visible",y="block",U="none",z="opacity",I="left",S="top",i="width",P="height",an="px",A="div",Y=window,R=document,f;var r={setLangVars:function(G){t(al,G)},init:function(at){if(at){t(J,at)}J.fullSize=J.fullSize?1:0;if(/MSIE ([^;]+)/.test(navigator.userAgent)){p=parseFloat(RegExp["$1"])}f=[];var av=R.getElementsByTagName("a"),au=new RegExp("^"+J.alias+"\\[([a-zA-Z]+)\\]|"+J.alias+"$"),ar;for(var aq=0,ap=av.length;aq<ap;aq++){if(av[aq].rel&&(ar=av[aq].rel.match(au))){m(av[aq],"click",r.showImage);if(ar=ar[1]){av[aq].__gallery__=ar;if(!f[ar]){f[ar]=[]}av[aq].__index__=f[ar].push(av[aq])-1}}}var G=R.getElementsByTagName("body")[0];G.appendChild(ai=ao(A,{id:"LG_overlay",events:{click:r.close}}));G.appendChild(T=D());innerCont=T.lastChild;m((G.attachEvent)?G:Y,"keypress",v);(x=ao("img")).onload=function(){e();l.setAttribute("src",x.src);q(J.fullSize,true);o()};g=T.offsetHeight;c=p?200:T.offsetWidth;h=0;ab(ai,{background:(J.overlayColor),display:U});aa(ai,J.overlayOpacity)},open:function(){if(d){return}n();l.style.display=y;q();ab(T,{visibility:am,display:y});d=1},close:function(){M();ab(T,{visibility:af,display:U});d=0;x.src=l.src=""},zoomIn:function(){r.Zoom(1+J.zoomStep)},zoomOut:function(){r.Zoom(1-J.zoomStep)},zoomNormal:function(){if(this.$disabled){return}r.Zoom(l.width==x.width&&l.height==x.height?0:1)},Zoom:function(G){ah();q(G)},showImage:function(ap){var G=this.__index__;N(ap||Y.event);if(this.__gallery__&&G>-1){aj=this.__gallery__;r.show(G)}else{r.showSingle(this)}},showSingle:function(G){r.open();ah();E();x.src=G.href;Q.innerHTML=G.title;b.innerHTML="";s.style.visibility=L.style.visibility=af},show:function(ap){if(ap<0||ap>f[aj].length-1||(J.animate&&ad)){return}r.open();var G=f[aj],aq=L.style,ar=s.style;ah();E();ad=1;x.src=G[ap].href;Q.innerHTML=G[ap].title;b.innerHTML=al.image+" "+(ap+1)+" "+al.of+" "+G.length;B=ap;ac()?aq.visibility=am:aq.visibility=af;u()?ar.visibility=am:ar.visibility=af;Y.focus()},next:function(){r.show(B+1)},prev:function(){r.show(B-1)}};function ac(){return(B<(f[aj].length-1))?true:false}function u(){return(B)?true:false}function o(){var G=f[aj];if(!G){return}if(G[B+1]){(new Image).src=G[B+1].href}if(G[B-1]){(new Image).src=G[B-1].href}}function n(ap){if(J.showOverlay){var G=C();ab(ai,{width:G[0]+"px",height:G[1]+"px"});if(ai.style.display!=y){ab(ai,{display:y});F(ai,{end:J.overlayOpacity*100,onend:ap})}}else{if(typeof ap=="function"){ap.call(this)}}}function M(){ae(ai,{start:J.overlayOpacity*100,onEnd:function(){ai.style.display=U}})}function q(aH,aB){var au,aL,az,aJ,aE=J.minPadding*2,aD=J.framesNumber,aI=x.width,aK=x.height,aF=C(),aq=aF[2],av=aF[3],aw=aq-aE-h,aM=av-aE-g;if(aH==0||(aB&&!aH)){if(aI>aw||aK>aM){var aA=aw,aG=aw*aK/aI;if(aG>aM){aG=aM;aA=aM*aI/aK}az=(l.width=aA)+h;aJ=(l.height=aG)+g}else{az=(l.width=aI)+h;aJ=(l.height=aK)+g}}else{if(aH==1){az=(l.width=aI)+h;aJ=(l.height=aK)+g}else{if(aH<1||aH>1){az=(l.width*=aH)+h;aJ=(l.height*=aH)+g}else{az=aJ=300;var ap=true}}}if(au=(az>(aw+h)||aJ>(aM+g))){aL=al.fitScreen;fsClass="LG_fitScreen"}else{if(l.width!=aI||l.height!=aK){aL=al.fullSize;fsClass="LG_zoomNormal"}}k.$disabled=false;if(l.width==aI){if(au){k.id=fsClass;k.setAttribute("title",aL)}else{k.id="LG_zoom_disabled";k.$disabled=true}}else{k.id="LG_zoomNormal";k.setAttribute("title",al.fullSize)}az=Math.max(az,c);var aN=W(),ax=(av>aJ?(av-aJ)/2:J.minPadding)+aN[1],ay=(aq>az?(aq-az)/2:J.minPadding)+aN[0],aC=(az/3)+"px",G=(aJ-g-10)+"px";ab(L,{width:aC,height:G});ab(s,{width:aC,height:G});if(J.animate&&!ap){var at=new K(T,aD,J.speed);if(J.resizeSync){at.addThread(i,0,az,0,aD).addThread(I,0,ay,0,aD).addThread(P,0,aJ,0,aD).addThread(S,0,ax,0,aD)}else{var aO=Math.ceil(aD/2);at.addThread(i,0,az,0,aO).addThread(I,0,ay,0,aO).addThread(P,0,aJ,aO,aD).addThread(S,0,ax,aO,aD)}at.onEnd=function(){n();O()};at.run()}else{ab(T,{top:ax+an,left:ay+an,width:az+an,height:aJ+an});n();O()}}function O(){innerCont.style.display=y;if(J.fadeImage){F(l,{frames:8,speed:J.speed,onEnd:function(){ad=0}})}else{aa(l,100);ad=0}}function ah(){innerCont.style.display=U}function E(){w.style.display=y}function e(){w.style.display=U}function D(){var ap,G;if(J.enableZoom){ap=ao(A,{id:"LG_zoomIn",title:al.zoomIn,events:{click:r.zoomIn}});G=ao(A,{id:"LG_zoomOut",title:al.zoomOut,events:{click:r.zoomOut}})}return ao(A,{id:"LG_container"},w=ao(A,{id:"LG_loading"}),ao(A,{id:"LG_innerCont"},ao(A,{id:"LG_panel"},ap,G,k=ao(A,{id:"LG_zoomNormal",title:al.fullSize,events:{click:r.zoomNormal}}),b=ao(A,{id:"LG_imgIndex"},al.image+" 20 "+al.of+" 20 "),ao(A,{id:"LG_closeBtn",title:al.close,events:{click:r.close}}),ao(A,{style:"clear:both"})),l=ao("img",{id:"LG_pic",width:300,height:300}),Q=ao(A,{id:"LG_titleBar"}),s=ao(A,{id:"LG_prevLink",title:al.prev,events:{click:r.prev,mouseover:Z,mouseout:ag}}),L=ao(A,{id:"LG_nextLink",title:al.next,events:{click:r.next,mouseover:Z,mouseout:ag}})))}function v(ap){if(!d){return}var ap=ap||Y.event,G=ap.keyCode?ap.keyCode:(ap.which?ap.which:ap.charCode);switch(G){case 110:r.next();break;case 98:r.prev();break;case 102:r.zoomNormal();break;case 43:r.zoomIn();break;case 45:r.zoomOut();break;case 27:r.close();default:return}N(ap)}function Z(){F(this)}function ag(){ae(this)}function F(ap,G){G=G||{};G.start=G.start||0;G.end=G.end||100;ak(ap,G)}function ae(ap,G){G=G||{};G.start=G.start||100;G.end=G.end||0;ak(ap,G)}function ak(aq,ap){if(J.animate){var G=new K(aq,ap.frames||5,ap.speed||40);G.addThread(z,ap.start,ap.end);G.onStart=ap.onStart;G.onEnd=ap.onEnd;G.run()}else{aa(aq,ap.end);if(typeof ap.onEnd=="function"){ap.onEnd()}}}function N(G){if(G.preventDefault){G.preventDefault()}else{G.returnValue=false}}function m(aq,ap,G){if(Y.addEventListener){m=function(au,at,ar){au.addEventListener(at,ar,false)}}else{if(Y.attachEvent){m=function(au,at,ar){var av=function(){ar.call(au,Y.event)};au.attachEvent("on"+at,av)}}}return m(aq,ap,G)}function t(aq,ap){for(var G in ap){aq[G]=ap[G]}}function ab(ap,G){if(ap){t(ap.style,G)}}function C(){var ar,ap,aq,au,G=R.body,at=R.documentElement;if(Y.innerHeight&&Y.scrollMaxY){ar=G.scrollWidth;ap=Y.innerHeight+Y.scrollMaxY}else{if(G.scrollHeight>G.offsetHeight){ar=G.scrollWidth;ap=G.scrollHeight}else{if(at&&at.scrollHeight>at.offsetHeight){ar=at.scrollWidth;ap=at.scrollHeight}else{ar=G.offsetWidth;ap=G.offsetHeight}}}if(Y.innerHeight){aq=G.clientWidth;au=Y.innerHeight}else{if(at&&at.clientHeight){aq=at.clientWidth;au=at.clientHeight}else{if(G){aq=G.clientWidth;au=G.clientHeight}}}return[ar<aq?aq:ar,ap<au?au:ap,aq,au]}function W(){var aq=0,ap=0,G=R.body,ar=R.documentElement;if(typeof(Y.pageYOffset)=="number"){ap=Y.pageYOffset;aq=Y.pageXOffset}else{if(G&&(G.scrollLeft||G.scrollTop)){ap=G.scrollTop;aq=G.scrollLeft}else{if(ar&&(ar.scrollLeft||ar.scrollTop)){ap=ar.scrollTop;aq=ar.scrollLeft}}}return[aq,ap]}function X(aq,G){var ar=R.defaultView;if(aq.style[G]){return aq.style[G]}else{if(aq.currentStyle){return aq.currentStyle[G]}else{if(ar&&ar.getComputedStyle){G=G.replace(/([A-Z])/g,"-$1");var ap=ar.getComputedStyle(aq,"");return ap&&ap.getPropertyValue(G.toLowerCase())}}}return null}function aa(){aa=arguments[0].filters?function(G,ap){G.style.filter="alpha(opacity="+ap+")"}:function(G,ap){G.style.opacity=ap/100};aa(arguments[0],arguments[1])}function ao(aq,ap){var av=R.createElement(aq);if(ap){for(var at in ap){if(at=="events"){for(var ar in ap[at]){m(av,ar,ap[at][ar])}}else{var aw=ap[at];if(typeof aw!="undefined"){if(at=="class"){av.className=aw}else{av.setAttribute(at,aw)}}}}}for(var au=2,G=arguments.length;au<G;au++){switch(typeof arguments[au]){case"string":av.innerHTML+=arguments[au];break;case"object":av.appendChild(arguments[au])}}return av}function j(){if(!H){if(!R.body){return setTimeout(j,13)}H=true;r.init()}}function V(){if(a){return}a=true;if(R.readyState==="complete"){return j()}if(R.addEventListener){R.addEventListener("DOMContentLoaded",function ap(){R.removeEventListener("DOMContentLoaded",ap,false);j()},false)}else{if(R.attachEvent){R.attachEvent("onreadystatechange",function at(){if(document.readyState==="complete"){R.detachEvent("onreadystatechange",at);j()}});var aq=false;try{aq=Y.frameElement==null}catch(ar){}if(R.documentElement.doScroll&&aq){function G(){if(H){return}try{R.documentElement.doScroll("left")}catch(au){setTimeout(G,1);return}j()}G()}}}}function K(aq,ap,G){if(!aq){return null}this.E=aq;this.N=ap||0;this.F=[];this.S=G||10}K.prototype={addThread:function(at,aq,G,ar,ap){if(!at||G===undefined||G===null){return}if(at!=z){aq=parseFloat(X(this.E,at))}ar=ar||0;ap=ap||this.N;var aw=this.F,av=(ap-ar)||1,au=(aq-G)/av;for(;ar<ap;ar++){if(!aw[ar]){aw[ar]={}}aw[ar][at]=(aq-=au)}return this},P:function(){var ar=this.F.shift(),ap=[],aq=p;if(ar){for(var G in ar){ap.push(G=="opacity"?(aq?"filter: alpha(opacity="+ar[G]+")":"opacity: "+ar[G]/100):G+": "+ar[G]+"px")}this.E.style.cssText+="; "+ap.join("; ")}else{if(typeof this.onEnd=="function"){this.onEnd()}clearInterval(this.I)}},run:function(){clearInterval(this.I);this.P();if(typeof this.onStart=="function"){this.onStart()}var G=this;if(this.N>1){this.I=setInterval(function(){G.P()},this.S)}}};return r})();
/* * ************** customcheckbox ******************/

function customchkbox()
{
//    	var checks =  document.getElementById('wrapper_checkbox').getElementsByTagName('label');
		var checks =  $('#wrapper_checkbox label');
    	var checksLnt = checks.length;
    	for(var i=0; i<checksLnt; i++)
    	{
    		var curr = checks[i];
    		var box = checks[i].firstChild;
    		if (box.nodeName == 'INPUT') {
        		box.className = 'lost';
				box.style.left = '-9999em';
        		checks[i].className += box.type;
    	    	checks[i].className += (box.checked) ? '-on' : '-off';
            }
            else continue;

    		box.onclick = function()
    		{
    			var label = this.parentNode;
   				label.className = (label.className.indexOf('-on')+1) ? label.className.replace('-on','-off') : label.className.replace('-off','-on');
    		}
    	}
}
/*
CUSTOM FORM ELEMENTS
*/

var checkboxHeight = "25";
var radioHeight = "25";


/* No need to change anything after this */

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;
				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {

			if($(inputs[a]).hasClass("styled")) {
				
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}

		if (this.getAttribute('onchange1'))
		{
			eval(this.getAttribute('onchange1'))
		}
	}
}



/* *********************************
        ON LOAD
********************************* */

$(function(){
    Custom.init();	
	$('#same_billing').click(function(){	
		if(!$("#same_billing").attr('checked'))
		{
		$('#billing_first_name').val('');
		$('#billing_last_name').val('');
		$('#billing_company_name').val('');
		$('#billing_addr').val('');
		$('#billing_city').val('');
		$('#billing_state').val('');
		$('#billing_zip').val('');
		$('#billing_suite').val('');
		}	
		else
		{
		$('#billing_first_name').val($('#personal_first_name').val());
		$('#billing_last_name').val($('#personal_last_name').val());
		$('#billing_company_name').val($('#personal_company_name').val());
		$('#billing_addr').val($('#personal_addr').val());
		$('#billing_city').val($('#personal_city').val());
		$('#billing_state').val($('#personal_state').val());
		$('#billing_zip').val($('#personal_zip').val());
		$('#billing_suite').val($('#personal_suite').val());
		}
	});
	
	
			
	$('#same_shipping').click(function(){	
		if(!$("#same_shipping").attr('checked'))
		{
		$('#ship_first_name').val('');
		$('#ship_last_name').val('');
		$('#ship_company_name').val('');
		$('#ship_addr').val('');
		$('#ship_city').val('');
		$('#ship_state').val('');
		$('#ship_zip').val('');
		$('#ship_suite').val('');
		$('#ship_hour').val('');
		$('#ship_email').val('');
		$('#ship_phone').val('');
		$('#ship_ext').val('');
		$('#ship_cell').val('');	
		}	
		else
		{
		$('#ship_first_name').val($('#personal_first_name').val());
		$('#ship_last_name').val($('#personal_last_name').val());
		$('#ship_company_name').val($('#personal_company_name').val());
		$('#ship_addr').val($('#personal_addr').val());
		$('#ship_city').val($('#personal_city').val());
		$('#ship_state').val($('#personal_state').val());
		$('#ship_zip').val($('#personal_zip').val());
		$('#ship_suite').val($('#personal_suite').val());
		$('#ship_hour').val($('#personal_hour').val());	
		$('#ship_email').val($('#personal_email').val());
		$('#ship_phone').val($('#personal_phone').val());
		$('#ship_ext').val($('#personal_ext').val());
		$('#ship_cell').val($('#personal_cell').val());
		}
	});	
	
	
	
	lightgallery.init();
	customchkbox();
	$("table.chart tbody tr:nth-child(2n)").addClass('nth-child');	
$('ul.thumbs li a').click(function(){
$('.thumb-img a').removeClass('active');
$($(this).attr('href')).addClass('active');
return false;
});	

  $(':input[required]').addClass("required").removeAttr('required');
	if(document.getElementById('contact-form') )
	{
		if (!elementSupportsAttribute('input','placeholder') && !(jQuery.browser.safari && (navigator.appVersion.indexOf('3.') != -1)))
		{

			var el = $(" input, select, textarea");
			for (var i=0; i<el.length; i++) {
			    if ($(el[i]).val() == "")
			    {
				  $(el[i]).addClass('placeholder');
			    }

				$(el[i]).blur(function() {
					if ($(this).val() =='')
					{
						$(this).addClass('placeholder');
					}
					else
					{
						$(this).removeClass('placeholder');
					}
									   })
			}
		}
	}
	
if(set_time==true){	
    $.getTime = function(zone, success) {
        var url = 'http://json-time.appspot.com/time.json?tz='
                + zone + '&callback=?';
        $.getJSON(url, function(o){
            success && success(new Date(o.datetime), o);
        });
    };

    function addSecs(d, s) {
    return new Date(d.valueOf()+s*1000);
    }

    // Usage:
    $.getTime('US/Arizona', function(time, z){
        var d = window['mydate'] = new Date(z.datetime.substr(0, z.datetime.length-5));
     setInterval(function ()
     {
      window['mydate'] = addSecs(window['mydate'], 1);
      var d = window['mydate'];
      var h = d.getHours();
      var m = d.getMinutes();
      var s = d.getSeconds();
      var ampm = (h>12?'pm':'am');
      h = (h>12?h-12:h);
        var z = (h<10?'0':'') + h + ':' + (m<10?'0':'') + m + ' ' + ampm;
      $('#time_now').html(z);
     }, 1000);


    // alert(z.datetime);
    });
}
	

	$("table.order tr:nth-child(2n)").addClass('nth-child');
	
	$('div.information-person li.phone label').click(function(){
		if ($('#personal_choose_phone').attr('checked'))
		{
		$('input#personal_phone').addClass('required');
		}
		else
		{
			$('input#personal_phone').removeClass('required');	
		}		
	});	
	
	$('div.information-person.different li.phone label').click(function(){
		if ($('#ship_choose_phone').attr('checked'))
		{
		$('input#ship_phone').addClass('required');
		}
		else
		{
			$('input#ship_phone').removeClass('required');	
		}	
	});	
	
});

