//Duncan Hart . duncan.hart@dhinteractive.co.uk . http://www.dhinteractive.co.uk

//***************************************************************************//
// QueryString Access
function QueryString(key){
var value = null;
for (var i=0;i<QueryString.keys.length;i++){
if (QueryString.keys[i]==key){
value = QueryString.values[i];
break;
}
}
return value;
}

QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse(){
var query = window.location.search.substring(1);
var pairs = query.split("&");
	
for (var i=0;i<pairs.length;i++){
var pos = pairs[i].indexOf('=');
if (pos >= 0){
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);

QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;

var languagecode = pairs[0]+"&"+pairs[1];
}
}

return languagecode;
}

var languagecode = QueryString_Parse();
//***************************************************************************//



//***************************************************************************//
// Dropdown Auto - CMT - 'Select Content'
function dropdown_auto(targ,selObj,restore){
eval(targ+".location='index.php?section="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto - CMT - 'Gallery'
function gallery_dropdown_auto(targ,selObj,restore){ //v3.0
eval(targ+".location='index.php?section=gallery&id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto - Newsletter
function newsletter_dropdown_auto(targ,selObj,restore){ //v3.0
eval(targ+".location='newsletter.php?type="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto - CMT - 'Client'
function clients_dropdown_auto(targ,selObj,restore){ //v3.0
eval(targ+".location='index.php?section=clients&client_id="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//

//***************************************************************************//
// Dropdown Auto - dev.saddingtonbaynes.com - 'Select Content'
function dev_dropdown_auto(targ,selObj,restore){
eval(targ+".location='index.php?pgid="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//***************************************************************************//



//***************************************************************************//
// Javascript Error Prompts
function confirmdeleterecord(action, id, section, additionalstring, pgnum){

// Configuration
if(section == "configuration"){
var msg = "Are you sure you want to delete this configuration?";
}

// Clients
if(section == "clients"){
var msg = "Are you sure you want to delete this record?";
}

// News
if(section == "news"){
var msg = "Are you sure you want to delete this news article?";
}

// Testimonial
if(section == "testimonials"){
var msg = "Are you sure you want to delete this Testimonial?";
}

// Lightbox
if(section == "lightbox"){
var msg = "Are you sure you want to delete this record?";
}

// Asset
if(section == "asset"){
var msg = "Are you sure you want to delete this asset?";
}

// Newsletter
if(section == "newsletter"){
var msg = "Are you sure you want to delete this subscriber?";
}

// Careers
if(section == "careers"){
var msg = "Are you sure you want to delete this vacancy?";
}

// Promos
if(section == "promos"){
var msg = "Are you sure you want to delete this Campaign?";
}

if(confirm(msg)){
top.location="index.php?id="+id+"&section="+action+"&reload="+section+"&"+additionalstring+"&pgnum="+pgnum;
}


}
//***************************************************************************//

//***************************************************************************//
// Form Box Selection
function formtextinsert(num, type, formname, txt){

// Load
if(type == "load"){
if(num == 1){
document[formname].email.value = txt;
}
}

// On
if(type == "on"){
if(num == 1){
if (document[formname].email.value == txt){
document[formname].email.value = "";
}
}
}

// Off
if(type == "off"){
if(num == 1){
if (document[formname].email.value == ""){
document[formname].email.value = txt;
}
}
}

}
//***************************************************************************//


//***************************************************************************//
// Form Box Selection
function newsletterregistration(formname, txt, form){
if(document[formname].email.value != txt){
popupwindow('_library/_templates/newsletter.php?email='+document[formname].email.value+'&type='+form+'','Window_3','300','400','cscreen','0','0','0','1','0','0','0','0');
}
}
//***************************************************************************//

