


// JavaScript Document
	

	var SITE_ROOT = "http://www.ikshare.com/1.00.01/";
	//var SITE_ROOT = document.site_root;



	function font_size(classSize){
		
		if(classSize == 1){
			changecss('.ikshare-links','font-size','11px');
			changecss('.ikshare-links:hover','font-size','11px');
			changecss('.pbshare_submission_name_and_loc','font-size','11px');
			changecss('.pbshare_submission_date','font-size','11px');
			changecss('.pbshare_submission_desc','font-size','11px');
			changecss('.pbshare_opening_title','font-size','11px');
			changecss('.pbshare_submission_story','font-size','11px');
			changecss('.ikshare_submission_name_and_date','font-size','11px');
			changecss('.ikshare_submission_det_title','font-size','11px');
			changecss('.pbshare_submission_comment_title','font-size','11px');
			changecss('.pbshare_submission_comment','font-size','11px');
			changecss('.pbshare_photo_caption','font-size','11px');
			changecss('.pbshare_size_10','font-size','11px');
		}

		if(classSize == 2){
			changecss('.ikshare-links','font-size','14px');
			changecss('.ikshare-links:hover','font-size','14px');
			changecss('.pbshare_submission_name_and_loc','font-size','14px');
			changecss('.pbshare_submission_date','font-size','14px');
			changecss('.pbshare_submission_desc','font-size','14px');
			changecss('.pbshare_opening_title','font-size','14px');
			changecss('.pbshare_submission_story','font-size','14px');
			changecss('.ikshare_submission_name_and_date','font-size','14px');
			changecss('.ikshare_submission_det_title','font-size','14px');
			changecss('.pbshare_submission_comment_title','font-size','14px');
			changecss('.pbshare_submission_comment','font-size','14px');
			changecss('.pbshare_photo_caption','font-size','14px');
			changecss('.pbshare_size_10','font-size','14px');
		}

		if(classSize == 3){
			changecss('.ikshare-links','font-size','16px');
			changecss('.ikshare-links:hover','font-size','16px');
			changecss('.pbshare_submission_name_and_loc','font-size','16px');
			changecss('.pbshare_submission_date','font-size','16px');
			changecss('.pbshare_submission_desc','font-size','16px');
			changecss('.pbshare_opening_title','font-size','16px');
			changecss('.pbshare_submission_story','font-size','16px');
			changecss('.ikshare_submission_name_and_date','font-size','16px');
			changecss('.ikshare_submission_det_title','font-size','16px');
			changecss('.pbshare_submission_comment_title','font-size','16px');
			changecss('.pbshare_submission_comment','font-size','16px');
			changecss('.pbshare_photo_caption','font-size','16px');
			changecss('.pbshare_size_10','font-size','16px');
		}
		

	// SET COOKIE - - - - - - - ->
	
	createCookie('ikshare_font_size',classSize,1);
	//alert(readCookie('clf_font_size'));	
	
	}
	
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 initFontSize() {
	fontSize = readCookie('ikshare_font_size');
	if(fontSize!=''){
		font_size(fontSize);
		}
	
	}




function changecss(theClass,element,value,element2) {
	//documentation for this script at http://www.shawnolson.net/a/503/
	var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    	document.styleSheets[S][cssRules][R].style['fontSize'] = value;
	    	document.styleSheets[S][cssRules][R].style[element] = value;
			//alert(document.styleSheets[S][cssRules][R].style[element]);
	   }
	  }
	 }	
	}

	
	
	function callModule(org_id, broadcast_id, start_page){
		initFontSize();
			if(start_page==''){
					start_page = 1;					
				};
			var params = ("&org_id="+org_id+"&broadcast_id="+broadcast_id+"&page="+start_page+"&agent="+navigator.userAgent) +"&"+ location.search.substring(1);
			document.write("<div class='pbshare_dyn_content' id='pbshare_dyn_div'></div>"); // Added this so Netscape 7.2 would work
			var html_str = '<script type="text/javascript" language="javascript" src="'+SITE_ROOT+'inc_pbshare_handler.php?'+params+'"></script>';
			document.write(html_str);
	};


	function callTeaser(org_id, broadcast_id, feature_id){
			var params = ("&org_id="+org_id+"&broadcast_id="+broadcast_id+"&feature_id="+feature_id+"&div_id=pbshare_dyn_div_teaser_"+feature_id+"&agent="+navigator.userAgent) +"&"+ location.search.substring(1) + "&page=teasers";
			//alert(params);
			document.write("<div class='pbshare_dyn_content' id='pbshare_dyn_div_teaser_"+feature_id+"'></div>"); // Added this so Netscape 7.2 would work
			var html_str = '<script type="text/javascript" language="javascript" src="'+SITE_ROOT+'inc_pbshare_handler.php?'+params+'"></script>';
			document.write(html_str);
	};

	function callFeatured(org_id, broadcast_id, num_records, detail_page){
			var params = ("&org_id="+org_id+"&broadcast_id="+broadcast_id+"&num_records="+num_records+"&detail_page="+detail_page+"&div_id=pbshare_dyn_div_teaser_featured&agent="+navigator.userAgent) +"&"+ location.search.substring(1) + "&page=featured";
			document.write("<div class='pbshare_dyn_content' id='pbshare_dyn_div_teaser_featured'></div>"); // Added this so Netscape 7.2 would work
			var html_str = '<script type="text/javascript" language="javascript" src="'+SITE_ROOT+'inc_pbshare_handler.php?'+params+'"></script>';
			document.write(html_str);
	};


	function charLimit(o,div,tot) {
		var currRemain = tot - o.value.length;
		if(currRemain<0){
				div.style.color = "#FF0000";
				var overBy = o.value.length - tot;
				div.innerHTML= ("(Exceeded limit by "+ overBy +")");
			}else{
				div.style.color = "#000000";
				div.innerHTML= ("("+currRemain+" remaining)");
			
			};
	}

	
	function popUp(center,url,winName,width,height,features) {
		//'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'
		
		if (center) {
			x = (640 - width)/2, y = (480 - height)/2;
			if (screen) {
				y = (screen.availHeight - height)/2;
				x = (screen.availWidth - width)/2;
			}
		}
		var newWin = window.open(url,winName,'scrollbars=no,width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+','+features);
		newWin.focus();
	}
	
	
//**************************************************************************************************************
//**************************************************************************************************************
//**************************************************************************************************************

	

	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}	
		
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_validateForm() { //v4.0
	  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
		  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
			if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
		  } else if (test!='R') { num = parseFloat(val);
			if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
			if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
			  min=test.substring(8,p); max=test.substring(p+1);
			  if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
	  } if (errors) alert('The following error(s) occurred:\n'+errors);
	  document.MM_returnValue = (errors == '');
	}
	
	
	
//function Validate_String(string, return_invalid_chars)
//         {
//         valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
//         invalid_chars = '';
//         
//         if(string == null || string == '')
//            return(true);
//         
//         //For every character on the string.   
//         for(index = 0; index < string.length; index++){
//            char = string.substr(index, 1);                        
//            
//            //Is it a valid character?
//            if(valid_chars.indexOf(char) == -1){
//              //If not, is it already on the list of invalid characters?
//              if(invalid_chars.indexOf(char) == -1){
//                //If it's not, add it.
//                if(invalid_chars == ''){
//                   invalid_chars += char;
//				}else{
//                   invalid_chars += ', ' + char;
//                }
//              }
//            }                     
//            
//         //If the string does not contain invalid characters, the function will return true.
//         //If it does, it will either return false or a list of the invalid characters used
//         //in the string, depending on the value of the second parameter.
//         if(return_invalid_chars == true && invalid_chars != '')
//           {
//           last_comma = invalid_chars.lastIndexOf(',');
//           
//           if(last_comma != -1)
//              invalid_chars = invalid_chars.substr(0, $last_comma) + 
//              ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);
//                      
//           return(invalid_chars);
//           }
//         else
//           return(invalid_chars == ''); 
//         }


function Validate_Email_Address(email_address)
         {
//         //Assumes that valid email addresses consist of user_name@domain.tld
//         at = email_address.indexOf('@');
//         dot = email_address.indexOf('.');
//         
//         if(at == -1 || 
//            dot == -1 || 
//            dot <= at + 1 ||
//            dot == 0 || 
//            dot == email_address.length - 1)
//            return(false);
//            
//         user_name = email_address.substr(0, at);
//         domain_name = email_address.substr(at + 1, email_address.length);                  
//         
//         if(Validate_String(user_name) === false || 
//            Validate_String(domain_name) === false)
//            return(false);                     
//         
//         return(true);



   return (email_address.indexOf(".") > 2) && (email_address.indexOf("@") > 0);
 




         }	
	
	
	function checkFormPage5(site_root){
	allGood=true;
		if(document.formPage5.checkbox.checked==false){
			MM_swapImage('required01','',site_root+'images/page_parts/white_required_arrow.gif',1);
			document.formPage5.required01.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required01','',site_root+'images/page_parts/white_required_blank.gif',1);
			document.formPage5.required01.width = 1;
			};
		if(document.formPage5.submission_name.value==''){
			MM_swapImage('required02','',site_root+'images/page_parts/white_required_arrow.gif',1);	
			document.formPage5.required02.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required02','',site_root+'images/page_parts/white_required_blank.gif',1);	
			document.formPage5.required02.width = 1;
			};
		if(document.formPage5.submission_location.value==''){
			MM_swapImage('required03','',site_root+'images/page_parts/white_required_arrow.gif',1);	
			document.formPage5.required03.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required03','',site_root+'images/page_parts/white_required_blank.gif',1);	
			document.formPage5.required03.width = 1;
			};
		if(!Validate_Email_Address(document.formPage5.submission_email.value)){
			MM_swapImage('required04','',site_root+'images/page_parts/white_required_arrow.gif',1);	
			document.formPage5.required04.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required04','',site_root+'images/page_parts/white_required_blank.gif',1);	
			document.formPage5.required04.width = 1;
			};
		// INIT STRING - - - - - - - - >
		message_str = ""; 
		if(allGood==true){
			return true;
		}else{
			alert("Some of the required fields in this page were not filled out."+message_str);
			return false;		
		};
	};
	
	function checkFormPage6(site_root){
	allGood=true;
		if(document.formPage6.submission_title.value==''){
			MM_swapImage('required01','',site_root+'images/page_parts/white_required_arrow.gif',1);	
			document.formPage6.required01.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required01','',site_root+'images/page_parts/white_required_blank.gif',1);	
			document.formPage6.required01.width = 1;
			};
		if(document.formPage6.submission_short_desc.value==''){
			MM_swapImage('required02','',site_root+'images/page_parts/white_required_arrow.gif',1);	
			document.formPage6.required02.width = 10;
			allGood=false;
			}else{
			MM_swapImage('required02','',site_root+'images/page_parts/white_required_blank.gif',1);	
			document.formPage6.required02.width = 1;
			};
		if(document.formPage6.submission_type_id.value==1){
			if(document.formPage6.submission_full_story.value==''){
				MM_swapImage('required03','',site_root+'images/page_parts/white_required_arrow.gif',1);	
				document.formPage6.required03.width = 10;
				allGood=false;
				}else{
				MM_swapImage('required03','',site_root+'images/page_parts/white_required_blank.gif',1);	
				document.formPage6.required03.width = 1;
				};
		};
		// INIT STRING - - - - - - - - >
		message_str = ""; 
		if(allGood==true){
			return true;
		}else{
			alert("Some of the required fields in this page were not filled out."+message_str);
			return false;		
		};
	};
	
	
	function checkFormPage7(site_root){
	allGood=true;
	message_str="";
	
	var img1 = new Image();
  	img1.src = document.formPage7.browse_image.value;
  	var img1width = parseInt(img1.width);
  	var img1height = parseInt(img1.height);
  
	//alert("This is image Test \n Width : " + img1width + "\n Height : " + img1height );

	if(document.formPage7.browse_image.value!=''){	
			
			//alert("document.formPage7.browse_image.value!=''");
			
			if(document.formPage7.browse_image.value.indexOf(".jpg", 0) == -1){
				message_str += "\n\nAdditionally your digital photo must be a Jpeg with a lowercase '.jpg' file extension."; 
				allGood=false;
				};
			
			if(document.formPage7.privacy.checked==false){
				MM_swapImage('required01','',site_root+'images/page_parts/white_required_arrow.gif',1);	
				document.formPage7.required01.width = 10;
				allGood=false;
				}else{
				MM_swapImage('required01','',site_root+'images/page_parts/white_required_blank.gif',1);	
				document.formPage7.required01.width = 1;
				};
		};

			
		// INIT STRING - - - - - - - - >
		//message_str = ""; 
		if(allGood==true){
			return true;
		}else{
			alert("Some of the required fields in this page were not filled out."+message_str);
			return false;		
		};
	};	
	
	
	function checkFormResources() {
		alert_pcs = new Array;
		alert_items = new Array;
		if (document.form1.resource_status[0].checked == false && document.form1.resource_status[1].checked == false) {
			alert_pcs[alert_pcs.length] = "- Enable";
			alert_items[alert_items.length] = 'resource_title_1'; //focus near radio
		}  			
		if (document.form1.resource_title_1.value == "") {
			alert_pcs[alert_pcs.length] = "- Linked name (line 1)";
			alert_items[alert_items.length] = 'resource_title_1';
		}	
		if (alert_pcs.length > 0) {
			alert("Your information has NOT been submitted. \n\nPlease provide information for the following fields:\n\n" + alert_pcs.join("\n"));
			document.form1[alert_items[0]].focus();
			return false;
		}
	}
	
	function checkFormResources() {
		alert_pcs = new Array;
		alert_items = new Array;
		if (document.form1.resource_status[0].checked == false && document.form1.resource_status[1].checked == false) {
			alert_pcs[alert_pcs.length] = "- Enable";
			alert_items[alert_items.length] = 'resource_title_1'; //focus near radio
		}  			
		if (document.form1.resource_title_1.value == "") {
			alert_pcs[alert_pcs.length] = "- Linked name (line 1)";
			alert_items[alert_items.length] = 'resource_title_1';
		}	
		if (alert_pcs.length > 0) {
			alert("Your information has NOT been submitted. \n\nPlease provide information for the following fields:\n\n" + alert_pcs.join("\n"));
			document.form1[alert_items[0]].focus();
			return false;
		}
	}
	
	function checkFormSubmissions() {
		alert_pcs = new Array;
		alert_items = new Array;
		if (document.form1.submission_vetted[0].checked == false && document.form1.submission_vetted[1].checked == false && document.form1.submission_vetted[2].checked == false) {
			alert_pcs[alert_pcs.length] = "- State";
			alert_items[alert_items.length] = 'submission_title'; //focus near radio
		}  			
		if (document.form1.submission_title.value == "") {
			alert_pcs[alert_pcs.length] = "- Story Title";
			alert_items[alert_items.length] = 'submission_title';
		}	
		if (alert_pcs.length > 0) {
			alert("Your information has NOT been submitted. \n\nPlease provide information for the following fields:\n\n" + alert_pcs.join("\n"));
			document.form1[alert_items[0]].focus();
			return false;
		}
	}	
	
	function checkFormComments() {
		alert_pcs = new Array;
		alert_items = new Array;
		if (document.form1.comment_vetted[0].checked == false && document.form1.comment_vetted[1].checked == false && document.form1.comment_vetted[2].checked == false) {
			alert_pcs[alert_pcs.length] = "- State";
			alert_items[alert_items.length] = 'comment_date'; //focus near radio
		}  			
		if (document.form1.comment_name.value == "") {
			alert_pcs[alert_pcs.length] = "- Name";
			alert_items[alert_items.length] = 'comment_name';
		}	
		if (document.form1.comment_comment.value == "") {
			alert_pcs[alert_pcs.length] = "- Comment";
			alert_items[alert_items.length] = 'comment_comment';
		}			
		if (alert_pcs.length > 0) {
			alert("Your information has NOT been submitted. \n\nPlease provide information for the following fields:\n\n" + alert_pcs.join("\n"));
			document.form1[alert_items[0]].focus();
			return false;
		}
	}		
	
	
//**************************************************************************************************************
//**************************************************************************************************************
//**************************************************************************************************************





/*********************************************************************************
  dw_cookies.js - cookie functions for www.dyn-web.com
  Recycled from various sources 
**********************************************************************************/
	
	// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
	// (found in JavaScript Bible)
	function setCookie(name,value,days,path,domain,secure) {
	  var expires, date;
	  if (typeof days == "number") {
		date = new Date();
		date.setTime( date.getTime() + (days*24*60*60*1000) );
			expires = date.toGMTString();
	  }
	  document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	}
	
	// Modified from Jesse Chisholm or Scott Andrew Lepera ?
	// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
	function getCookie(name) {
	  var nameq = name + "=";
	  var c_ar = document.cookie.split(';');
	  for (var i=0; i<c_ar.length; i++) {
		var c = c_ar[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
	  }
	  return null;
	}
	
	// from Bill Dortch's Cookie Functions (hidaho.com) 
	function deleteCookie(name,path,domain) {
	  if (getCookie(name)) {
		document.cookie = name + "=" +
		  ((path) ? "; path=" + path : "") +
		  ((domain) ? "; domain=" + domain : "") +
		  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	  }
	}
	
	
	
	function toggle_link_type(input) {
		var row_url = document.getElementById('row_resource_link_type_url');
		var row_pdf = document.getElementById('row_resource_link_type_pdf');
		if (input.id == "input_link_type_url") {
			row_pdf.style.display='';
			row_url.style.display='none';
		} else {
			row_pdf.style.display='none';
			row_url.style.display='';
		}
	}	
	


