function displayError(title, message) {

new Dialog().showMessage(title, message); return false;

 new Dialog(Dialog.DIALOG_CONTEXTUAL).setContext(context).showChoice(title, message, 'Ok', ''); 
 
 } 

function hit(linkid,id,url,dspan,disp){
	old = element(linkid).href;
	element('niframe').src = 'hit.php?id='+id;
	element(linkid).target = '_blank';
	element(linkid).href = url;
	element(dspan).innerHTML = disp;
	_this = old;
	_this2 = linkid;
	setTimeout('element(_this2).href = _this','3000');
	//alert(element(linkid).href);
	
}

function urls(){
	
		if (!document.getElementsByTagName){ return; } else {
		var anchors = document.getElementsByTagName('a'); }
		
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			items = relAttribute.split(",");
			alert(items[0],items[1],items[2],items[3])
			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('hit,'))){
				anchor.onclick = function () {
					element('niframe').src = 'hit.php?id='+items[1];
				}
				
			}
			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('goto,'))){
				anchor.onclick = function () {
					itemid = anchor.getAttribute('id');
					element(itemid).href = items[3];
				}			
			}
		}

	
	
	
}


function closewindow(){

window.opener.location.reload();
window.close();
	
}

function popUp($url,w,h) {
   mywindow = window.open ($url,"mywindow","location=0,status=0,scrollbars=1,toolbar=0,menubar=0,titlebar=0,width=" + w + ",height=" + h + "");
  mywindow.moveTo(300,200);
 }
 
 function http(field){
 field.value=field.value.replace('http://','');
 } function http(field){
 field.value=field.value.replace('http://','');
 }
 
 
 function element(id){
	 return document.getElementById(id);
 }
 
 
 function pdf(type,id){
	
element('niframe').src='dl2.php?type='+type+'&id='+id;


}
 
function CheckContact(theform){

var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title");
error += isBlank(theform.name.value,"Please enter your Name");
error += isBlank(theform.surname.value,"Please enter your Surname");
error += checkEmail(theform.email.value,"Please enter a valid Email Address");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number");
error += isBlank(theform.comments.value,"Please enter your comments or questions");

if(error != ""){ alert(error); return false; }  // else { return true; }
}

function CheckURL(theform){

var error = "";
/*//*/
error += isBlank(theform.title.value,"Please enter your Listing Title.");
error += isBlank(theform.text.value,"Please enter your Description.");
error += dropdown(theform.cat,"Please choose a Category.");
error += isBlank(theform.name.value,"Please enter your Name.");
error += checkEmail(theform.email.value,"Please enter a valid Email Address.");
error += isBlank(theform.veri.value,"Please enter the Verification Code.");

if(error != ""){ alert(error); return false; }  // else { return true; }
}

function CheckArt(theform){

var error = "";
/*//*/
error += isBlank(theform.title.value,"Please enter a Title.");
error += dropdown(theform.cat,"Please choose a Category.");
error += isBlank(theform.name.value,"Please enter the Author Name.");
error += checkEmail(theform.email.value,"Please enter a valid Email Address.");
error += isBlank(theform.veri.value,"Please enter the Verification Code.");

if(error != ""){ alert(error); return false; }  // else { return true; }
}

 
function over(src,state){
	if(state == "on"){
	document.getElementById(src).src='images/salamanav-over_'+src+'.jpg';	
	}
	if(state == "off"){
	document.getElementById(src).src='images/salamanav_'+src+'.jpg';	
	} 
}
/*/ 
/*/
function ismaxlength(obj){

var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""

if (obj.getAttribute && obj.value.length>mlength)

obj.value=obj.value.substring(0,mlength)

}

 function http(field){
 field.value=field.value.replace('http://','');
 } function http(field){
 field.value=field.value.replace('http://','');
 }
 
 ////////////////
 
 

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
 
function isBlank(str,msg){
	var error = "";
	str = trim(str)
	if(str.length == 0){ error = msg +'\n'; }
	return error;
	}


function fieldmatch(str1,str2,msg){
	var error = "";
	if(str1 != str2){
	error = msg +'\n';
	}
	return error;

}



function checkEmail (strng,msg) {
var error="";
	if (isBlank(strng)) { error = msg + "\n"; }
	
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { error = msg + "\n"; }
		else {
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;    
}

function isEmptyNum(strng,msg) {
var error = "";
	if (isBlank(strng)) { error = msg + "\n"; } else {
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;	  
}
function valNum(strng,msg) {
var error = "";
	if(strng.length != 0){
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
	}
	return error;	  
}


function radio(radiobut,strng){
var error = "";
var radio_choice = false;
for (i = 0; i < radiobut.length; i++){
if (radiobut[i].checked)
radio_choice = true; 
}
if (!radio_choice){ error = ""+strng+"\n"; }
return error; }

function dropdown(menu,strng){
var error = "";
 if ( menu.selectedIndex == 0 )
    {
        error = strng+" \n";
        valid = false;
    }
	return error; }
	


function toggleLayer(whichLayer){
if (document.getElementById) {
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
}
else if (document.all){
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
} else if (document.layers) {
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block"; }
}

function dropother(menu,layer){
 if ( menu.selectedIndex == 1 ){
 	toggleLayer(layer); } else { 	
	if(document.getElementById(layer).style.display == "block"){
 	toggleLayer(layer); } }

}
function strMatch(f1,f2,msg){
var error = "";
 if (f1 != f2){
	 error = msg+"\n";
	 }


}

var disqus_iframe_css = "http://www.simplylinks.co.za/css/disqus02.css";
var disqus_developer  = 0;
function loadDisqus(){
	if(!document.getElementById("disqus_thread"))return;
	var script = document.createElement("script");
	script.setAttribute("type","text/javascript");
	script.setAttribute("src","/js/disqus.js");
	document.body.appendChild(script);
	var css = document.createElement("link");
	css.setAttribute("href","/css/disqus03.css");
	css.setAttribute("type","text/css");
	css.setAttribute("rel","stylesheet");
	document.getElementsByTagName("head")[0].appendChild(css);
}




/*//*/

-->


