// JavaScript Document
//change this value when you add more images....
var _small_add=0;
var _big_add=0;
var limit_ads = 5;
var links = {
	"urls":["https://www.recyclebank.com/","http://www.envista.com/","http://www.lorman.com/","http://www.plcm.org/","http://www.empoweredmunicipality.com/empowered-municipality-finalist-in-techquest-awards"]	
};

//alias for search engine
var scatl = '';
var setCategorylist = function(obj){
	scatl = obj;
}
var sconl='';
var setContactlist = function(obj){
	sconl = obj;
}

var ssearch = ''
var showSearch = function(obj){
	ssearch = obj;
}

var random_number = function(){
	var x = Math.floor(Math.random()*limit_ads);
	return x;
}

var crap=([]);


var _no_duplicate_ads=function(){
	_small_add = random_number();
	_big_add = random_number();
	while(_small_add == _big_add){
		_small_add = random_number();
	}
}

var show_small_ad=function(){
	var int_x = _small_add;
	var img_x="";
	
	if(int_x<10){
		img_x = "0"+int_x;
	} else {
		img_x = int_x;
	}
	var template = '<a href="'+links["urls"][int_x]+'"  style="margin-bottom:15px; display:block" target="_blank"><img src="img/ad_small'+img_x+'.jpg" width="216" height="171" border="0" /></a>'
	jQuery('#ad_small').append(template);
};

var show_big_ad=function(){
	var int_x = _big_add;
	var img_x="";
	if(int_x<10){
		img_x = "0"+int_x;
	} else {
		img_x = int_x;
	}
	var template = '<a href="'+links["urls"][int_x]+'" style="margin-bottom:10px; display:block"  target="_blank"><img src="img/ad_big'+img_x+'.gif" width="216" height="352" border="0" /></a>';
	jQuery('#ad_big').append(template);
};

var toggleChk = function(id,obj){
	if ($(obj).attr("checked")===true){
		$("#"+id+" .child input:checkbox").attr('checked',true);
	} else {
		$("#"+id+" .child input:checkbox").attr('checked',false);
	}								 
}

var resetParent = function(id){
	var checkedlist = $("#"+id+" .child input:checkbox:checked").length
	/* var chklst = $("#"+id+" #child input:checkbox").length 
	if( checkedlist < chklst){ //all or none */
	if( checkedlist < 1){ //one of all
		$("#"+id+" .parent input:checkbox").attr('checked',false);
	}else {
		$("#"+id+" .parent input:checkbox").attr('checked',true);
	}	
}

$(document).ready(function(){
    _no_duplicate_ads();
	show_small_ad();
	show_big_ad();
	setTimeout(function () {
	    $('.skype_pnh_container').html('');
	    $('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
	}, 1000);
})

function showvideointro(p_width,p_height){
	Shadowbox.open({
        content:    '<object class="cantaloupe_video" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="480" height="294" id="backlight_player" align="middle" style="background:#000000"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="http://player.backlight.tv/player/?video_code=87PL93GUSXSJUQum1h70gMkRKsFooA6239EQ90L6239EQ90L" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="flashvars" value="" /><param name="wmode" value="transparent" /><embed src="http://player.backlight.tv/player/?video_code=87PL93GUSXSJUQum1h70gMkRKsFooA6239EQ90L6239EQ90L" flashvars="" quality="high" bgcolor="#000000" width="'+p_width+'" height="'+p_height+'" name="backlight_player" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" style="background:#000000"/></object>',
        player:     "html",
        height:     p_height,
        width:      p_width
    });
}
